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

(-)a/t/db_dependent/TestBuilder.t (-2 / +34 lines)
Lines 21-28 use Modern::Perl; Link Here
21
21
22
use utf8;
22
use utf8;
23
23
24
use Test::More tests => 15;
24
use Test::More tests => 16;
25
use Test::Warn;
25
use Test::Warn;
26
use Try::Tiny;
26
use File::Basename qw(dirname);
27
use File::Basename qw(dirname);
27
28
28
use Koha::Database;
29
use Koha::Database;
Lines 544-546 subtest 'Existence of object is only checked using primary keys' => sub { Link Here
544
545
545
    $schema->storage->txn_rollback;
546
    $schema->storage->txn_rollback;
546
};
547
};
547
- 
548
549
subtest 'Test bad columns' => sub {
550
    plan tests => 3;
551
    $schema->storage->txn_begin;
552
553
    try {
554
        my $patron = $builder->build_object({ class => 'Koha::Patrons', value => { wrong => 1 } });
555
        ok( 0, 'Unexpected pass with wrong column' );
556
    }
557
    catch {
558
        like( $_, qr/^Error: value hash contains unrecognized columns: wrong/, 'Column wrong is bad' );
559
    };
560
    try {
561
        my $patron = $builder->build_object({ class => 'Koha::Patrons', value => { surname => 'Pass', nested => { ignored => 1 }} });
562
        ok( 1, 'Nested hash ignored' );
563
    }
564
    catch {
565
        ok( 0, 'Unexpected trouble with nested hash' );
566
    };
567
    try {
568
        my $patron = $builder->build_object({
569
            class => 'Koha::Patrons',
570
             value => { surname => 'WontPass', categorycode => { description => 'bla', wrong_nested => 1 }},
571
        });
572
        ok( 0, 'Unexpected pass with wrong nested column' );
573
    }
574
    catch {
575
        like( $_, qr/^Error: value hash contains unrecognized columns: wrong_nested/, 'Column wrong_nested is bad' );
576
    };
577
578
    $schema->storage->txn_rollback;
579
};

Return to bug 32350