Lines 32-38
my $builder = t::lib::TestBuilder->new;
Link Here
|
32 |
|
32 |
|
33 |
subtest 'filter_by_active() tests' => sub { |
33 |
subtest 'filter_by_active() tests' => sub { |
34 |
|
34 |
|
35 |
plan tests => 4; |
35 |
plan tests => 5; |
36 |
|
36 |
|
37 |
$schema->storage->txn_begin; |
37 |
$schema->storage->txn_begin; |
38 |
|
38 |
|
Lines 66-94
subtest 'filter_by_active() tests' => sub {
Link Here
|
66 |
{ |
66 |
{ |
67 |
class => 'Koha::Acquisition::Orders', |
67 |
class => 'Koha::Acquisition::Orders', |
68 |
value => { |
68 |
value => { |
69 |
basketno => $basket_1->basketno, |
69 |
basketno => $basket_1->basketno, |
70 |
orderstatus => 'new' |
70 |
orderstatus => 'new', |
|
|
71 |
quantity => 1, |
72 |
quantityreceived => 0, |
71 |
} |
73 |
} |
72 |
} |
74 |
} |
73 |
); |
75 |
); |
74 |
my $order_4 = $builder->build_object( |
76 |
my $order_4 = $builder->build_object( |
75 |
{ |
77 |
{ |
76 |
class => 'Koha::Acquisition::Orders', |
78 |
class => 'Koha::Acquisition::Orders', |
77 |
value => { orderstatus => 'ordered' } |
79 |
value => { orderstatus => 'ordered', quantity => 1, quantityreceived => 0 } |
78 |
} |
80 |
} |
79 |
); |
81 |
); |
80 |
my $order_5 = $builder->build_object( |
82 |
my $order_5 = $builder->build_object( |
81 |
{ |
83 |
{ |
82 |
class => 'Koha::Acquisition::Orders', |
84 |
class => 'Koha::Acquisition::Orders', |
83 |
value => { orderstatus => 'partial' } |
85 |
value => { orderstatus => 'partial', quantity => 2, quantityreceived => 1 } |
84 |
} |
86 |
} |
85 |
); |
87 |
); |
86 |
my $order_6 = $builder->build_object( |
88 |
my $order_6 = $builder->build_object( |
87 |
{ |
89 |
{ |
88 |
class => 'Koha::Acquisition::Orders', |
90 |
class => 'Koha::Acquisition::Orders', |
89 |
value => { |
91 |
value => { |
90 |
basketno => $basket_2->basketno, |
92 |
basketno => $basket_2->basketno, |
91 |
orderstatus => 'new' |
93 |
orderstatus => 'new', |
|
|
94 |
quantity => 1, |
95 |
quantityreceived => 0, |
92 |
} |
96 |
} |
93 |
} |
97 |
} |
94 |
); |
98 |
); |
Lines 116-121
subtest 'filter_by_active() tests' => sub {
Link Here
|
116 |
is( $rs->next->ordernumber, $order_4->ordernumber , 'Expected order in resultset' ); |
120 |
is( $rs->next->ordernumber, $order_4->ordernumber , 'Expected order in resultset' ); |
117 |
is( $rs->next->ordernumber, $order_5->ordernumber , 'Expected order in resultset' ); |
121 |
is( $rs->next->ordernumber, $order_5->ordernumber , 'Expected order in resultset' ); |
118 |
|
122 |
|
|
|
123 |
# If we change quantities on order_5 (partial), we should no longer see it |
124 |
$order_5->quantityreceived(2)->store; |
125 |
is( $this_orders_rs->filter_by_active->count, 2, 'Dropped one order as expected' ); |
126 |
|
119 |
$schema->storage->txn_rollback; |
127 |
$schema->storage->txn_rollback; |
120 |
}; |
128 |
}; |
121 |
|
129 |
|
122 |
- |
|
|