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

(-)a/t/db_dependent/Koha/Notice/Message.t (-2 / +17 lines)
Lines 257-266 subtest 'patron() tests' => sub { Link Here
257
};
257
};
258
258
259
subtest 'template() tests' => sub {
259
subtest 'template() tests' => sub {
260
    plan tests => 2;
260
    plan tests => 4;
261
261
262
    $schema->storage->txn_begin;
262
    $schema->storage->txn_begin;
263
263
264
    # Valid template and message
264
    my $template = $builder->build_object( { class => 'Koha::Notice::Templates' } );
265
    my $template = $builder->build_object( { class => 'Koha::Notice::Templates' } );
265
    my $message  = $builder->build_object(
266
    my $message  = $builder->build_object(
266
        {
267
        {
Lines 272-277 subtest 'template() tests' => sub { Link Here
272
    is( ref( $message->template ), 'Koha::Notice::Template', 'Object type is correct' );
273
    is( ref( $message->template ), 'Koha::Notice::Template', 'Object type is correct' );
273
    is( $message->template->id,    $template->id,            'Right template linked' );
274
    is( $message->template->id,    $template->id,            'Right template linked' );
274
275
276
    # Deleted template
277
    $template->delete;
278
    $message->discard_changes;
279
    is( $message->template, undef, 'Returns undef if template was deleted' );
280
281
    # Missing template
282
    $message = $builder->build_object(
283
        {
284
            class => 'Koha::Notice::Messages',
285
            value => { letter_id => undef }
286
        }
287
    );
288
289
    is( $message->template, undef, 'Returns undef if no template used for message' );
290
275
    $schema->storage->txn_rollback;
291
    $schema->storage->txn_rollback;
276
};
292
};
277
293
278
- 

Return to bug 33260