|
Lines 19-25
Link Here
|
| 19 |
|
19 |
|
| 20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
| 21 |
|
21 |
|
| 22 |
use Test::More tests => 2; |
22 |
use Test::More tests => 3; |
| 23 |
use t::lib::TestBuilder; |
23 |
use t::lib::TestBuilder; |
| 24 |
|
24 |
|
| 25 |
use Koha::Database; |
25 |
use Koha::Database; |
|
Lines 72-74
subtest 'user() tests' => sub {
Link Here
|
| 72 |
|
72 |
|
| 73 |
$schema->storage->txn_rollback; |
73 |
$schema->storage->txn_rollback; |
| 74 |
}; |
74 |
}; |
| 75 |
- |
75 |
|
|
|
76 |
subtest 'strings_map() tests' => sub { |
| 77 |
plan tests => 8; |
| 78 |
|
| 79 |
$schema->storage->txn_begin; |
| 80 |
|
| 81 |
my $status_av = $builder->build_object( |
| 82 |
{ |
| 83 |
class => 'Koha::AuthorisedValues', |
| 84 |
value => { |
| 85 |
authorised_value => 'TEST', |
| 86 |
category => 'TICKET_STATUS', |
| 87 |
lib => 'internal description', |
| 88 |
lib_opac => 'public description', |
| 89 |
} |
| 90 |
} |
| 91 |
); |
| 92 |
|
| 93 |
my $ticket_update = $builder->build_object( |
| 94 |
{ |
| 95 |
class => 'Koha::Ticket::Updates', |
| 96 |
value => { status => 'TEST' } |
| 97 |
} |
| 98 |
); |
| 99 |
|
| 100 |
my $strings = $ticket_update->strings_map(); |
| 101 |
ok( exists $strings->{status}, "'status' entry exists" ); |
| 102 |
is( $strings->{status}->{str}, $status_av->lib, "'str' set to av->lib" ); |
| 103 |
is( $strings->{status}->{type}, 'av', "'type' is 'av'" ); |
| 104 |
is( $strings->{status}->{category}, 'TICKET_STATUS', "'category' exists and set to 'TICKET_STATUS'" ); |
| 105 |
|
| 106 |
$strings = $ticket_update->strings_map( { public => 1 } ); |
| 107 |
ok( exists $strings->{status}, "'status' entry exists when called in public" ); |
| 108 |
is( $strings->{status}->{str}, $status_av->lib_opac, "'str' set to av->lib_opac when called in public" ); |
| 109 |
is( $strings->{status}->{type}, 'av', "'type' is 'av'" ); |
| 110 |
is( $strings->{status}->{category}, 'TICKET_STATUS', "'category' exists and set to 'TICKET_STATUS'" ); |
| 111 |
}; |