Lines 38-59
sub no_history : Test( 4 ) {
Link Here
|
38 |
|
38 |
|
39 |
=cut |
39 |
=cut |
40 |
|
40 |
|
41 |
sub one_order : Test( 50 ) { |
41 |
my $INVOICE = "1234-56 AB"; |
|
|
42 |
sub one_order : Test( 55 ) { |
42 |
my $self = shift; |
43 |
my $self = shift; |
43 |
|
44 |
|
44 |
my ( $basketno, $ordernumber ) = $self->create_new_basket(); |
45 |
my ( $basketno, $ordernumber ) = $self->create_new_basket(invoice => $INVOICE); |
45 |
ok( $basketno, "basketno is $basketno" ); |
46 |
ok( $basketno, "basketno is $basketno" ); |
46 |
ok( $ordernumber, "ordernumber is $ordernumber" ); |
47 |
ok( $ordernumber, "ordernumber is $ordernumber" ); |
47 |
|
48 |
|
48 |
# No arguments fetches no history. |
49 |
# No arguments fetches no history. |
49 |
{ |
50 |
{ |
50 |
my ( $order_loop, $total_qty, $total_price, $total_qtyreceived) = GetHistory(); |
51 |
my ( $order_loop, $total_qty, $total_price, $total_qtyreceived) = eval { GetHistory() }; |
51 |
# diag( Data::Dumper->Dump( [ $order_loop, $total_qty, $total_price, $total_qtyreceived ], [ qw( order_loop total_qty total_price total_qtyreceived ) ] ) ); |
52 |
# diag( Data::Dumper->Dump( [ $order_loop, $total_qty, $total_price, $total_qtyreceived ], [ qw( order_loop total_qty total_price total_qtyreceived ) ] ) ); |
52 |
|
53 |
|
53 |
is( scalar @$order_loop, 0, 'order_loop is empty' ); |
54 |
is( $order_loop, undef, 'order_loop is empty' ); |
54 |
is( $total_qty, 0, 'total_qty' ); |
|
|
55 |
is( $total_price, 0, 'total_price' ); |
56 |
is( $total_qtyreceived, 0, 'total_qtyreceived' ); |
57 |
} |
55 |
} |
58 |
|
56 |
|
59 |
my $bibliodata = GetBiblioData( $self->{'biblios'}[0] ); |
57 |
my $bibliodata = GetBiblioData( $self->{'biblios'}[0] ); |
Lines 62-68
sub one_order : Test( 50 ) {
Link Here
|
62 |
|
60 |
|
63 |
# searching by title should find it. |
61 |
# searching by title should find it. |
64 |
{ |
62 |
{ |
65 |
my ( $order_loop, $total_qty, $total_price, $total_qtyreceived) = GetHistory( $bibliodata->{'title'} ); |
63 |
my ( $order_loop, $total_qty, $total_price, $total_qtyreceived) = GetHistory( title => $bibliodata->{'title'} ); |
66 |
# diag( Data::Dumper->Dump( [ $order_loop, $total_qty, $total_price, $total_qtyreceived ], [ qw( order_loop total_qty total_price total_qtyreceived ) ] ) ); |
64 |
# diag( Data::Dumper->Dump( [ $order_loop, $total_qty, $total_price, $total_qtyreceived ], [ qw( order_loop total_qty total_price total_qtyreceived ) ] ) ); |
67 |
|
65 |
|
68 |
is( scalar @$order_loop, 1, 'order_loop searched by title' ); |
66 |
is( scalar @$order_loop, 1, 'order_loop searched by title' ); |
Lines 73-81
sub one_order : Test( 50 ) {
Link Here
|
73 |
# diag( Data::Dumper->Dump( [ $order_loop ], [ 'order_loop' ] ) ); |
71 |
# diag( Data::Dumper->Dump( [ $order_loop ], [ 'order_loop' ] ) ); |
74 |
} |
72 |
} |
75 |
|
73 |
|
|
|
74 |
# searching by basket number |
75 |
{ |
76 |
my ( $order_loop, $total_qty, $total_price, $total_qtyreceived) = GetHistory( basket => $basketno ); |
77 |
# diag( Data::Dumper->Dump( [ $order_loop, $total_qty, $total_price, $total_qtyreceived ], [ qw( order_loop total_qty total_price total_qtyreceived ) ] ) ); |
78 |
|
79 |
is( scalar @$order_loop, 1, 'order_loop searched by basket no' ); |
80 |
is( $total_qty, 1, 'total_qty searched by basket no' ); |
81 |
is( $total_price, 1, 'total_price searched by basket no' ); |
82 |
is( $total_qtyreceived, 0, 'total_qtyreceived searched by basket no' ); |
83 |
|
84 |
# diag( Data::Dumper->Dump( [ $order_loop ], [ 'order_loop' ] ) ); |
85 |
} |
86 |
|
87 |
# searching by invoice number |
88 |
{ |
89 |
my ( $order_loop, $total_qty, $total_price, $total_qtyreceived) = GetHistory( booksellerinvoicenumber => $INVOICE ); |
90 |
# diag( Data::Dumper->Dump( [ $order_loop, $total_qty, $total_price, $total_qtyreceived ], [ qw( order_loop total_qty total_price total_qtyreceived ) ] ) ); |
91 |
|
92 |
is( scalar @$order_loop, 1, 'order_loop searched by invoice no' ); |
93 |
is( $total_qty, 1, 'total_qty searched by invoice no' ); |
94 |
is( $total_price, 1, 'total_price searched by invoice no' ); |
95 |
is( $total_qtyreceived, 0, 'total_qtyreceived searched by invoice no' ); |
96 |
|
97 |
# diag( Data::Dumper->Dump( [ $order_loop ], [ 'order_loop' ] ) ); |
98 |
} |
99 |
|
76 |
# searching by author |
100 |
# searching by author |
77 |
{ |
101 |
{ |
78 |
my ( $order_loop, $total_qty, $total_price, $total_qtyreceived) = GetHistory( undef, $bibliodata->{'author'} ); |
102 |
my ( $order_loop, $total_qty, $total_price, $total_qtyreceived) = GetHistory( author => $bibliodata->{'author'} ); |
79 |
# diag( Data::Dumper->Dump( [ $order_loop, $total_qty, $total_price, $total_qtyreceived ], [ qw( order_loop total_qty total_price total_qtyreceived ) ] ) ); |
103 |
# diag( Data::Dumper->Dump( [ $order_loop, $total_qty, $total_price, $total_qtyreceived ], [ qw( order_loop total_qty total_price total_qtyreceived ) ] ) ); |
80 |
|
104 |
|
81 |
is( scalar @$order_loop, 1, 'order_loop searched by author' ); |
105 |
is( scalar @$order_loop, 1, 'order_loop searched by author' ); |
Lines 92-98
sub one_order : Test( 50 ) {
Link Here
|
92 |
ok( $bookseller->{'name'}, 'bookseller name' ) |
116 |
ok( $bookseller->{'name'}, 'bookseller name' ) |
93 |
or diag( Data::Dumper->Dump( [ $bookseller ], [ 'bookseller' ] ) ); |
117 |
or diag( Data::Dumper->Dump( [ $bookseller ], [ 'bookseller' ] ) ); |
94 |
|
118 |
|
95 |
my ( $order_loop, $total_qty, $total_price, $total_qtyreceived) = GetHistory( undef, undef, $bookseller->{'name'} ); |
119 |
my ( $order_loop, $total_qty, $total_price, $total_qtyreceived) = GetHistory( name => $bookseller->{'name'} ); |
96 |
# diag( Data::Dumper->Dump( [ $order_loop, $total_qty, $total_price, $total_qtyreceived ], [ qw( order_loop total_qty total_price total_qtyreceived ) ] ) ); |
120 |
# diag( Data::Dumper->Dump( [ $order_loop, $total_qty, $total_price, $total_qtyreceived ], [ qw( order_loop total_qty total_price total_qtyreceived ) ] ) ); |
97 |
|
121 |
|
98 |
is( scalar @$order_loop, 1, 'order_loop searched by name' ); |
122 |
is( scalar @$order_loop, 1, 'order_loop searched by name' ); |
Lines 106-112
sub one_order : Test( 50 ) {
Link Here
|
106 |
my $tomorrow = $self->tomorrow(); |
130 |
my $tomorrow = $self->tomorrow(); |
107 |
# diag( "tomorrow is $tomorrow" ); |
131 |
# diag( "tomorrow is $tomorrow" ); |
108 |
|
132 |
|
109 |
my ( $order_loop, $total_qty, $total_price, $total_qtyreceived) = GetHistory( undef, undef, undef, undef, $tomorrow ); |
133 |
my ( $order_loop, $total_qty, $total_price, $total_qtyreceived) = GetHistory( to_placed_on => $tomorrow ); |
110 |
# diag( Data::Dumper->Dump( [ $order_loop, $total_qty, $total_price, $total_qtyreceived ], [ qw( order_loop total_qty total_price total_qtyreceived ) ] ) ); |
134 |
# diag( Data::Dumper->Dump( [ $order_loop, $total_qty, $total_price, $total_qtyreceived ], [ qw( order_loop total_qty total_price total_qtyreceived ) ] ) ); |
111 |
|
135 |
|
112 |
is( scalar @$order_loop, 1, 'order_loop searched by to_date' ); |
136 |
is( scalar @$order_loop, 1, 'order_loop searched by to_date' ); |
Lines 120-126
sub one_order : Test( 50 ) {
Link Here
|
120 |
my $yesterday = $self->yesterday(); |
144 |
my $yesterday = $self->yesterday(); |
121 |
# diag( "yesterday was $yesterday" ); |
145 |
# diag( "yesterday was $yesterday" ); |
122 |
|
146 |
|
123 |
my ( $order_loop, $total_qty, $total_price, $total_qtyreceived) = GetHistory( undef, undef, undef, $yesterday ); |
147 |
my ( $order_loop, $total_qty, $total_price, $total_qtyreceived) = GetHistory( from_placed_on => $yesterday ); |
124 |
# diag( Data::Dumper->Dump( [ $order_loop, $total_qty, $total_price, $total_qtyreceived ], [ qw( order_loop total_qty total_price total_qtyreceived ) ] ) ); |
148 |
# diag( Data::Dumper->Dump( [ $order_loop, $total_qty, $total_price, $total_qtyreceived ], [ qw( order_loop total_qty total_price total_qtyreceived ) ] ) ); |
125 |
|
149 |
|
126 |
is( scalar @$order_loop, 1, 'order_loop searched by from_date' ); |
150 |
is( scalar @$order_loop, 1, 'order_loop searched by from_date' ); |
Lines 134-140
sub one_order : Test( 50 ) {
Link Here
|
134 |
|
158 |
|
135 |
# just search by title here, we need to search by something. |
159 |
# just search by title here, we need to search by something. |
136 |
{ |
160 |
{ |
137 |
my ( $order_loop, $total_qty, $total_price, $total_qtyreceived) = GetHistory( $bibliodata->{'title'} ); |
161 |
my ( $order_loop, $total_qty, $total_price, $total_qtyreceived) = GetHistory( title => $bibliodata->{'title'} ); |
138 |
# diag( Data::Dumper->Dump( [ $order_loop, $total_qty, $total_price, $total_qtyreceived ], [ qw( order_loop total_qty total_price total_qtyreceived ) ] ) ); |
162 |
# diag( Data::Dumper->Dump( [ $order_loop, $total_qty, $total_price, $total_qtyreceived ], [ qw( order_loop total_qty total_price total_qtyreceived ) ] ) ); |
139 |
|
163 |
|
140 |
is( scalar @$order_loop, 1, 'order_loop searched by title' ); |
164 |
is( scalar @$order_loop, 1, 'order_loop searched by title' ); |
141 |
- |
|
|