7 use Test
::More tests
=> 7;
10 use_ok
('C4::Circulation');
18 DeleteOfflineOperation
23 my $dbh = C4
::Context
->dbh;
24 $dbh->{RaiseError
} = 1;
25 $dbh->{AutoCommit
} = 0;
27 $dbh->do(q
|DELETE FROM issues
|);
28 $dbh->do(q
|DELETE FROM borrowers
|);
29 $dbh->do(q
|DELETE FROM items
|);
30 $dbh->do(q
|DELETE FROM branches
|);
31 $dbh->do(q
|DELETE FROM pending_offline_operations
|);
36 branchname
=> 'Sample Branch',
37 branchaddress1
=> 'sample adr1',
38 branchaddress2
=> 'sample adr2',
39 branchaddress3
=> 'sample adr3',
40 branchzip
=> 'sample zip',
41 branchcity
=> 'sample city',
42 branchstate
=> 'sample state',
43 branchcountry
=> 'sample country',
44 branchphone
=> 'sample phone',
45 branchfax
=> 'sample fax',
46 branchemail
=> 'sample email',
47 branchurl
=> 'sample url',
48 branchip
=> 'sample ip',
49 branchprinter
=> undef,
50 opac_info
=> 'sample opac',
52 Koha
::Library
->new($samplebranch1)->store;
55 #Test AddOfflineOperation
58 'User1', $samplebranch1->{branchcode
},
59 'null', 'Action1', 'CODE', 'Cardnumber1', 10
62 "OfflineOperation has been added"
65 $dbh->last_insert_id( undef, undef, 'pending_offline_operations', undef );
67 #Test GetOfflineOperations
69 GetOfflineOperation
($offline_id),
71 operationid
=> $offline_id,
73 branchcode
=> $samplebranch1->{branchcode
},
74 timestamp
=> "0000-00-00 00:00:00",
77 cardnumber
=> 'Cardnumber1',
80 "GetOffline returns offlineoperation's informations"
82 is
( GetOfflineOperation
(), undef,
83 'GetOfflineOperation without parameters returns undef' );
84 is
( GetOfflineOperation
(-1), undef,
85 'GetOfflineOperation with wrong parameters returns undef' );
87 #Test GetOfflineOperations
88 #TODO later: test GetOfflineOperations
89 # Actually we cannot mock C4::Context->userenv in unit tests
91 #Test DeleteOfflineOperation
92 is
( DeleteOfflineOperation
($offline_id),
93 'Deleted.', 'Offlineoperation has been deleted' );
95 #is (DeleteOfflineOperation(), undef, 'DeleteOfflineOperation without id returns undef');
96 #is (DeleteOfflineOperation(-1),undef, 'DeleteOfflineOperation with a wrong id returns undef');#FIXME