Bugzilla – Attachment 169842 Details for
Bug 37510
Koha::Object->delete should throw a Koha::Exception if there's a parent row constraint
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 37510: Unit tests
Bug-37510-Unit-tests.patch (text/plain), 1.48 KB, created by
Tomás Cohen Arazi (tcohen)
on 2024-07-29 14:34:16 UTC
(
hide
)
Description:
Bug 37510: Unit tests
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2024-07-29 14:34:16 UTC
Size:
1.48 KB
patch
obsolete
>From 39411437ddf0b30e885323b9d17821013f62edd6 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Mon, 29 Jul 2024 09:16:11 -0300 >Subject: [PATCH] Bug 37510: Unit tests > >--- > t/db_dependent/Koha/Object.t | 29 ++++++++++++++++++++++++++++- > 1 file changed, 28 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Koha/Object.t b/t/db_dependent/Koha/Object.t >index b1c6bb51728..abf21295308 100755 >--- a/t/db_dependent/Koha/Object.t >+++ b/t/db_dependent/Koha/Object.t >@@ -17,7 +17,7 @@ > > use Modern::Perl; > >-use Test::More tests => 22; >+use Test::More tests => 23; > use Test::Exception; > use Test::Warn; > >@@ -1237,3 +1237,30 @@ subtest 'is_accessible() tests' => sub { > > $schema->storage->txn_rollback; > }; >+ >+subtest 'delete() tests' => sub { >+ >+ plan tests => 6; >+ >+ $schema->storage->txn_begin; >+ >+ my $rs = $builder->build_object( { class => 'Koha::RecordSources' } ); >+ my $biblio = $builder->build_sample_biblio(); >+ >+ $biblio->metadata->set( { record_source_id => $rs->id } )->store(); >+ >+ throws_ok { $rs->delete(); } >+ 'Koha::Exceptions::Object::FKConstraintDeletion'; >+ >+ is( $@->column, 'record_source_id' ); >+ is( $@->constraint, 'record_metadata_fk_2' ); >+ is( $@->fk, 'record_source_id' ); >+ is( $@->table, 'biblio_metadata' ); >+ >+ $biblio->metadata->set( { record_source_id => undef } )->store(); >+ >+ lives_ok { $rs->delete(); } >+ 'No exception thrown'; >+ >+ $schema->storage->txn_rollback; >+}; >-- >2.45.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 37510
:
169829
|
169830
|
169842
|
169843
|
169848
|
169849
|
169938
|
169939
|
170464