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

(-)a/t/db_dependent/Koha/Object.t (-2 / +28 lines)
Lines 17-23 Link Here
17
17
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
use Test::More tests => 22;
20
use Test::More tests => 23;
21
use Test::Exception;
21
use Test::Exception;
22
use Test::Warn;
22
use Test::Warn;
23
23
Lines 1237-1239 subtest 'is_accessible() tests' => sub { Link Here
1237
1237
1238
    $schema->storage->txn_rollback;
1238
    $schema->storage->txn_rollback;
1239
};
1239
};
1240
- 
1240
1241
subtest 'delete() tests' => sub {
1242
1243
    plan tests => 6;
1244
1245
    $schema->storage->txn_begin;
1246
1247
    my $rs     = $builder->build_object( { class => 'Koha::RecordSources' } );
1248
    my $biblio = $builder->build_sample_biblio();
1249
1250
    $biblio->metadata->set( { record_source_id => $rs->id } )->store();
1251
1252
    throws_ok { $rs->delete(); }
1253
    'Koha::Exceptions::Object::FKConstraintDeletion';
1254
1255
    is( $@->column,     'record_source_id' );
1256
    is( $@->constraint, 'record_metadata_fk_2' );
1257
    is( $@->fk,         'record_source_id' );
1258
    is( $@->table,      'biblio_metadata' );
1259
1260
    $biblio->metadata->set( { record_source_id => undef } )->store();
1261
1262
    lives_ok { $rs->delete(); }
1263
    'No exception thrown';
1264
1265
    $schema->storage->txn_rollback;
1266
};

Return to bug 37510