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|);
37 branchname => 'Sample Branch',
38 branchaddress1 => 'sample adr1',
39 branchaddress2 => 'sample adr2',
40 branchaddress3 => 'sample adr3',
41 branchzip => 'sample zip',
42 branchcity => 'sample city',
43 branchstate => 'sample state',
44 branchcountry => 'sample country',
45 branchphone => 'sample phone',
46 branchfax => 'sample fax',
47 branchemail => 'sample email',
48 branchurl => 'sample url',
49 branchip => 'sample ip',
50 branchprinter => undef,
51 opac_info => 'sample opac',
53 ModBranch($samplebranch1);
56 #Test AddOfflineOperation
59 'User1', $samplebranch1->{branchcode},
60 'null', 'Action1', 'CODE', 'Cardnumber1', 10
63 "OfflineOperation has been added"
66 $dbh->last_insert_id( undef, undef, 'pending_offline_operations', undef );
68 #Test GetOfflineOperations
70 GetOfflineOperation($offline_id),
72 operationid => $offline_id,
74 branchcode => $samplebranch1->{branchcode},
75 timestamp => "0000-00-00 00:00:00",
78 cardnumber => 'Cardnumber1',
81 "GetOffline returns offlineoperation's informations"
83 is( GetOfflineOperation(), undef,
84 'GetOfflineOperation without parameters returns undef' );
85 is( GetOfflineOperation(-1), undef,
86 'GetOfflineOperation with wrong parameters returns undef' );
88 #Test GetOfflineOperations
89 #TODO later: test GetOfflineOperations
90 # Actually we cannot mock C4::Context->userenv in unit tests
92 #Test DeleteOfflineOperation
93 is( DeleteOfflineOperation($offline_id),
94 'Deleted.', 'Offlineoperation has been deleted' );
96 #is (DeleteOfflineOperation(), undef, 'DeleteOfflineOperation without id returns undef');
97 #is (DeleteOfflineOperation(-1),undef, 'DeleteOfflineOperation with a wrong id returns undef');#FIXME