|
Lines 66-75
subtest 'session_register_name' => sub {
Link Here
|
| 66 |
|
66 |
|
| 67 |
subtest 'all() tests' => sub { |
67 |
subtest 'all() tests' => sub { |
| 68 |
|
68 |
|
| 69 |
plan tests => 20; |
69 |
plan tests => 21; |
| 70 |
|
70 |
|
| 71 |
$schema->storage->txn_begin; |
71 |
$schema->storage->txn_begin; |
| 72 |
|
72 |
|
|
|
73 |
t::lib::Mocks::mock_preference( 'UseCashRegisters', 1 ); |
| 74 |
|
| 73 |
my $count = Koha::Cash::Registers->search({ archived => 0 })->count; |
75 |
my $count = Koha::Cash::Registers->search({ archived => 0 })->count; |
| 74 |
my $max_register = Koha::Cash::Registers->search( {}, |
76 |
my $max_register = Koha::Cash::Registers->search( {}, |
| 75 |
{ order_by => { '-desc' => 'id' }, rows => 1 } )->single; |
77 |
{ order_by => { '-desc' => 'id' }, rows => 1 } )->single; |
|
Lines 110-117
subtest 'all() tests' => sub {
Link Here
|
| 110 |
{ |
112 |
{ |
| 111 |
class => 'Koha::Cash::Registers', |
113 |
class => 'Koha::Cash::Registers', |
| 112 |
value => { |
114 |
value => { |
| 113 |
branch => $library2->branchcode, |
115 |
branch => $library2->branchcode, |
| 114 |
archived => 0 |
116 |
archived => 0 |
| 115 |
} |
117 |
} |
| 116 |
} |
118 |
} |
| 117 |
); |
119 |
); |
|
Lines 177-182
subtest 'all() tests' => sub {
Link Here
|
| 177 |
); |
179 |
); |
| 178 |
} |
180 |
} |
| 179 |
|
181 |
|
|
|
182 |
t::lib::Mocks::mock_preference( 'UseCashRegisters', 0 ); |
| 183 |
$result = $plugin->all(); |
| 184 |
is( $result, undef, "Return undef when UseCashRegisters is disabled" ); |
| 185 |
|
| 180 |
$schema->storage->txn_rollback; |
186 |
$schema->storage->txn_rollback; |
| 181 |
}; |
187 |
}; |
| 182 |
|
188 |
|
| 183 |
- |
|
|