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

(-)a/t/db_dependent/Koha/Object.t (-6 / +8 lines)
Lines 399-415 subtest 'store() tests' => sub { Link Here
399
399
400
    subtest 'Bad value tests' => sub {
400
    subtest 'Bad value tests' => sub {
401
401
402
        plan tests => 1;
402
        plan tests => 3;
403
403
404
        my $patron = $builder->build_object({ class => 'Koha::Patrons' });
404
        my $patron = $builder->build_object({ class => 'Koha::Patrons' });
405
405
406
        my $print_error = $schema->storage->dbh->{PrintError};
406
        my $print_error = $schema->storage->dbh->{PrintError};
407
        $schema->storage->dbh->{PrintError} = 0;
407
        $schema->storage->dbh->{PrintError} = 0;
408
408
409
        throws_ok
409
        try {
410
            { $patron->lastseen('wrong_value')->store; }
410
            $patron->lastseen('wrong_value')->store;
411
            'Koha::Exceptions::Object::BadValue',
411
        } catch {
412
            'Exception thrown correctly';
412
            ok( $_->isa('Koha::Exceptions::Object::BadValue'), 'Exception thrown correctly' );
413
            like( $_->property, qr/borrowers\W?\.\W?lastseen/, 'Column should be the expected one' ); # optional \W for quote or backtic
414
            is( $_->value, 'wrong_value', 'Value should be the expected one' );
415
        };
413
416
414
        $schema->storage->dbh->{PrintError} = $print_error;
417
        $schema->storage->dbh->{PrintError} = $print_error;
415
    };
418
    };
416
- 

Return to bug 23825