Lines 66-72
subtest 'session_register_name' => sub {
Link Here
|
66 |
|
66 |
|
67 |
subtest 'all() tests' => sub { |
67 |
subtest 'all() tests' => sub { |
68 |
|
68 |
|
69 |
plan tests => 21; |
69 |
plan tests => 25; |
70 |
|
70 |
|
71 |
$schema->storage->txn_begin; |
71 |
$schema->storage->txn_begin; |
72 |
|
72 |
|
Lines 179-184
subtest 'all() tests' => sub {
Link Here
|
179 |
); |
179 |
); |
180 |
} |
180 |
} |
181 |
|
181 |
|
|
|
182 |
$result = $plugin->all( { filters => { current_branch => 1 }, selected => $register1->id } ); |
183 |
is( ref($result), 'ARRAY', |
184 |
"Return arrayref (userenv: branchcode + register_id, filters: current_branch, selected: register 1)" |
185 |
); |
186 |
is( |
187 |
scalar( @{$result} ), |
188 |
2, |
189 |
"Array contains 2 branch registers (userenv: branchcode + register_id, filters: current_branch, selected: register 1)" |
190 |
); |
191 |
for my $register ( @{$result} ) { |
192 |
my $selected = ( $register->{id} == $register1->id ) ? 1 : 0; |
193 |
is( $register->{selected}, $selected, |
194 |
"Register is selected $selected (userenv: brancode, filters: current_branch, selected: register 1)" |
195 |
); |
196 |
} |
197 |
|
182 |
t::lib::Mocks::mock_preference( 'UseCashRegisters', 0 ); |
198 |
t::lib::Mocks::mock_preference( 'UseCashRegisters', 0 ); |
183 |
$result = $plugin->all(); |
199 |
$result = $plugin->all(); |
184 |
is( $result, undef, "Return undef when UseCashRegisters is disabled" ); |
200 |
is( $result, undef, "Return undef when UseCashRegisters is disabled" ); |
185 |
- |
|
|