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

(-)a/t/db_dependent/Koha/Notice/Message.t (-2 / +17 lines)
Lines 404-413 subtest 'patron() tests' => sub { Link Here
404
};
404
};
405
405
406
subtest 'template() tests' => sub {
406
subtest 'template() tests' => sub {
407
    plan tests => 2;
407
    plan tests => 4;
408
408
409
    $schema->storage->txn_begin;
409
    $schema->storage->txn_begin;
410
410
411
    # Valid template and message
411
    my $template = $builder->build_object( { class => 'Koha::Notice::Templates' } );
412
    my $template = $builder->build_object( { class => 'Koha::Notice::Templates' } );
412
    my $message  = $builder->build_object(
413
    my $message  = $builder->build_object(
413
        {
414
        {
Lines 419-424 subtest 'template() tests' => sub { Link Here
419
    is( ref( $message->template ), 'Koha::Notice::Template', 'Object type is correct' );
420
    is( ref( $message->template ), 'Koha::Notice::Template', 'Object type is correct' );
420
    is( $message->template->id,    $template->id,            'Right template linked' );
421
    is( $message->template->id,    $template->id,            'Right template linked' );
421
422
423
    # Deleted template
424
    $template->delete;
425
    $message->discard_changes;
426
    is( $message->template, undef, 'Returns undef if template was deleted' );
427
428
    # Missing template
429
    $message = $builder->build_object(
430
        {
431
            class => 'Koha::Notice::Messages',
432
            value => { letter_id => undef }
433
        }
434
    );
435
436
    is( $message->template, undef, 'Returns undef if no template used for message' );
437
422
    $schema->storage->txn_rollback;
438
    $schema->storage->txn_rollback;
423
};
439
};
424
440
425
- 

Return to bug 33260