1 package KohaTest::Acquisition::GetLateOrders;
2 use base qw( KohaTest::Acquisition );
17 sub no_orders : Test( 1 ) {
20 my @orders = GetLateOrders( 1 );
21 is( scalar @orders, 0, 'There are no orders, so we found 0.' )
22 or diag( Data::Dumper->Dump( [ \@orders ], [ 'orders' ] ) );
30 sub one_order : Test( 29 ) {
33 my ( $basketid, $ordernumber ) = $self->create_new_basket();
34 ok( $basketid, 'a new basket was created' );
35 ok( $ordernumber, 'the basket has an order in it.' );
36 # we need this basket to be closed.
37 CloseBasket( $basketid );
39 my @orders = GetLateOrders( 0 );
42 my @orders = GetLateOrders( 0 );
43 is( scalar @orders, 1, 'An order closed today is 0 days late.' )
44 or diag( Data::Dumper->Dump( [ \@orders ], [ 'orders' ] ) );
47 my @orders = GetLateOrders( 1 );
48 is( scalar @orders, 0, 'An order closed today is not 1 day late.' )
49 or diag( Data::Dumper->Dump( [ \@orders ], [ 'orders' ] ) );
52 my @orders = GetLateOrders( -1 );
53 is( scalar @orders, 1, 'an order closed today is -1 day late.' )
54 or diag( Data::Dumper->Dump( [ \@orders ], [ 'orders' ] ) );
57 # provide some vendor information
59 my @orders = GetLateOrders( 0, $self->{'booksellerid'} );
60 is( scalar @orders, 1, 'We found this late order with the right supplierid.' )
61 or diag( Data::Dumper->Dump( [ \@orders ], [ 'orders' ] ) );
64 my @orders = GetLateOrders( 0, $self->{'booksellerid'} + 1 );
65 is( scalar @orders, 0, 'We found no late orders with the wrong supplierid.' )
66 or diag( Data::Dumper->Dump( [ \@orders ], [ 'orders' ] ) );
69 # provide some branch information
70 my $member = GetMember( borrowernumber=>$self->{'memberid'} );
71 # diag( Data::Dumper->Dump( [ $member ], [ 'member' ] ) );
73 my @orders = GetLateOrders( 0, $self->{'booksellerid'}, $member->{'branchcode'} );
74 is( scalar @orders, 1, 'We found this late order with the right branchcode.' )
75 or diag( Data::Dumper->Dump( [ \@orders ], [ 'orders' ] ) );
78 my @orders = GetLateOrders( 0, $self->{'booksellerid'}, 'This is not the branch' );
79 is( scalar @orders, 0, 'We found no late orders with the wrong branchcode.' )
80 or diag( Data::Dumper->Dump( [ \@orders ], [ 'orders' ] ) );
83 # set up some things necessary to make GetLateOrders use the IndependantBranches
84 $self->enable_independant_branches();
87 my @orders = GetLateOrders( 0, $self->{'booksellerid'}, $member->{'branchcode'} );
88 is( scalar @orders, 1, 'We found this late order with the right branchcode.' )
89 or diag( Data::Dumper->Dump( [ \@orders ], [ 'orders' ] ) );
92 my @orders = GetLateOrders( 0, $self->{'booksellerid'}, 'This is not the branch' );
93 is( scalar @orders, 0, 'We found no late orders with the wrong branchcode.' )
94 or diag( Data::Dumper->Dump( [ \@orders ], [ 'orders' ] ) );
98 $self->disable_independant_branches();