View | Details | Raw Unified | Return to bug 32435
Collapse All | Expand All

(-)a/t/db_dependent/Koha/Ticket.t (-1 / +32 lines)
Lines 229-235 subtest 'store() tests' => sub { Link Here
229
};
229
};
230
230
231
subtest 'strings_map() tests' => sub {
231
subtest 'strings_map() tests' => sub {
232
    plan tests => 8;
232
    plan tests => 16;
233
233
234
    $schema->storage->txn_begin;
234
    $schema->storage->txn_begin;
235
235
Lines 264-268 subtest 'strings_map() tests' => sub { Link Here
264
    is( $strings->{status}->{type},     'av',                 "'type' is 'av'" );
264
    is( $strings->{status}->{type},     'av',                 "'type' is 'av'" );
265
    is( $strings->{status}->{category}, 'TICKET_STATUS',      "'category' exists and set to 'TICKET_STATUS'" );
265
    is( $strings->{status}->{category}, 'TICKET_STATUS',      "'category' exists and set to 'TICKET_STATUS'" );
266
266
267
    my $resolution_av = $builder->build_object(
268
        {
269
            class => 'Koha::AuthorisedValues',
270
            value => {
271
                authorised_value => 'RES_TEST',
272
                category         => 'TICKET_RESOLUTION',
273
                lib              => 'internal resolution description',
274
                lib_opac         => 'public resolution description',
275
            }
276
        }
277
    );
278
279
    $ticket = $builder->build_object(
280
        {
281
            class => 'Koha::Tickets',
282
            value => { status => 'RES_TEST' }
283
        }
284
    );
285
286
    $strings = $ticket->strings_map();
287
    ok( exists $strings->{status}, "'status' entry exists for resolution fallthrough" );
288
    is( $strings->{status}->{str},      $resolution_av->lib, "'str' set to av->lib" );
289
    is( $strings->{status}->{type},     'av',            "'type' is 'av'" );
290
    is( $strings->{status}->{category}, 'TICKET_STATUS', "'category' exists and set to 'TICKET_STATUS'" );
291
292
    $strings = $ticket->strings_map( { public => 1 } );
293
    ok( exists $strings->{status}, "'status' entry exists for resolution fallthrough when called in public" );
294
    is( $strings->{status}->{str},      $resolution_av->lib_opac, "'str' set to av->lib_opac when called in public" );
295
    is( $strings->{status}->{type},     'av',                 "'type' is 'av'" );
296
    is( $strings->{status}->{category}, 'TICKET_STATUS',      "'category' exists and set to 'TICKET_STATUS'" );
297
267
    $schema->storage->txn_rollback;
298
    $schema->storage->txn_rollback;
268
};
299
};
(-)a/t/db_dependent/Koha/Ticket/Update.t (-2 / +32 lines)
Lines 74-80 subtest 'user() tests' => sub { Link Here
74
};
74
};
75
75
76
subtest 'strings_map() tests' => sub {
76
subtest 'strings_map() tests' => sub {
77
    plan tests => 8;
77
    plan tests => 16;
78
78
79
    $schema->storage->txn_begin;
79
    $schema->storage->txn_begin;
80
80
Lines 109-113 subtest 'strings_map() tests' => sub { Link Here
109
    is( $strings->{status}->{type},     'av',                 "'type' is 'av'" );
109
    is( $strings->{status}->{type},     'av',                 "'type' is 'av'" );
110
    is( $strings->{status}->{category}, 'TICKET_STATUS',      "'category' exists and set to 'TICKET_STATUS'" );
110
    is( $strings->{status}->{category}, 'TICKET_STATUS',      "'category' exists and set to 'TICKET_STATUS'" );
111
111
112
    my $resolution_av = $builder->build_object(
113
        {
114
            class => 'Koha::AuthorisedValues',
115
            value => {
116
                authorised_value => 'RES_TEST',
117
                category         => 'TICKET_RESOLUTION',
118
                lib              => 'internal resolution description',
119
                lib_opac         => 'public resolution description',
120
            }
121
        }
122
    );
123
124
    $ticket_update = $builder->build_object(
125
        {
126
            class => 'Koha::Ticket::Updates',
127
            value => { status => 'RES_TEST' }
128
        }
129
    );
130
131
    $strings = $ticket_update->strings_map();
132
    ok( exists $strings->{status}, "'status' entry exists for resolution fallthrough" );
133
    is( $strings->{status}->{str},      $resolution_av->lib, "'str' set to av->lib" );
134
    is( $strings->{status}->{type},     'av',            "'type' is 'av'" );
135
    is( $strings->{status}->{category}, 'TICKET_STATUS', "'category' exists and set to 'TICKET_STATUS'" );
136
137
    $strings = $ticket_update->strings_map( { public => 1 } );
138
    ok( exists $strings->{status}, "'status' entry exists for resolution fallthrough when called in public" );
139
    is( $strings->{status}->{str},      $resolution_av->lib_opac, "'str' set to av->lib_opac when called in public" );
140
    is( $strings->{status}->{type},     'av',                 "'type' is 'av'" );
141
    is( $strings->{status}->{category}, 'TICKET_STATUS',      "'category' exists and set to 'TICKET_STATUS'" );
142
112
    $schema->storage->txn_rollback;
143
    $schema->storage->txn_rollback;
113
};
144
};
114
- 

Return to bug 32435