Lines 19-25
Link Here
|
19 |
|
19 |
|
20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
21 |
|
21 |
|
22 |
use Test::More tests => 6; |
22 |
use Test::More tests => 7; |
23 |
use t::lib::TestBuilder; |
23 |
use t::lib::TestBuilder; |
24 |
use t::lib::Mocks; |
24 |
use t::lib::Mocks; |
25 |
|
25 |
|
Lines 227-229
subtest 'store() tests' => sub {
Link Here
|
227 |
$schema->storage->txn_rollback; |
227 |
$schema->storage->txn_rollback; |
228 |
}; |
228 |
}; |
229 |
}; |
229 |
}; |
230 |
- |
230 |
|
|
|
231 |
subtest 'strings_map() tests' => sub { |
232 |
plan tests => 8; |
233 |
|
234 |
$schema->storage->txn_begin; |
235 |
|
236 |
my $status_av = $builder->build_object( |
237 |
{ |
238 |
class => 'Koha::AuthorisedValues', |
239 |
value => { |
240 |
authorised_value => 'TEST', |
241 |
category => 'TICKET_STATUS', |
242 |
lib => 'internal description', |
243 |
lib_opac => 'public description', |
244 |
} |
245 |
} |
246 |
); |
247 |
|
248 |
my $ticket = $builder->build_object( |
249 |
{ |
250 |
class => 'Koha::Tickets', |
251 |
value => { status => 'TEST' } |
252 |
} |
253 |
); |
254 |
|
255 |
my $strings = $ticket->strings_map(); |
256 |
ok( exists $strings->{status}, "'status' entry exists" ); |
257 |
is( $strings->{status}->{str}, $status_av->lib, "'str' set to av->lib" ); |
258 |
is( $strings->{status}->{type}, 'av', "'type' is 'av'" ); |
259 |
is( $strings->{status}->{category}, 'TICKET_STATUS', "'category' exists and set to 'TICKET_STATUS'" ); |
260 |
|
261 |
$strings = $ticket->strings_map( { public => 1 } ); |
262 |
ok( exists $strings->{status}, "'status' entry exists when called in public" ); |
263 |
is( $strings->{status}->{str}, $status_av->lib_opac, "'str' set to av->lib_opac when called in public" ); |
264 |
is( $strings->{status}->{type}, 'av', "'type' is 'av'" ); |
265 |
is( $strings->{status}->{category}, 'TICKET_STATUS', "'category' exists and set to 'TICKET_STATUS'" ); |
266 |
|
267 |
$schema->storage->txn_rollback; |
268 |
}; |