Bugzilla – Attachment 143991 Details for
Bug 31080
Block adding the bundle item to its own bundle
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 31080: Unit tests
Bug-31080-Unit-tests.patch (text/plain), 2.00 KB, created by
Katrin Fischer
on 2022-11-17 10:55:29 UTC
(
hide
)
Description:
Bug 31080: Unit tests
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2022-11-17 10:55:29 UTC
Size:
2.00 KB
patch
obsolete
>From 62be81824012b323bfc107e5d9619f3c69141625 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Mon, 4 Jul 2022 11:20:31 +0100 >Subject: [PATCH] Bug 31080: Unit tests > >Unit tests for add_to_bundle functionality that prevents bundle nesting. > >Test plan >1) Run t/db_dependent/Koha/Item.t >2) The test should fail >3) Apply the second patch >4) Re-run the test and watch it pass. > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > t/db_dependent/Koha/Item.t | 14 +++++++++++++- > 1 file changed, 13 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Koha/Item.t b/t/db_dependent/Koha/Item.t >index cf438e4469..21ac0bae98 100755 >--- a/t/db_dependent/Koha/Item.t >+++ b/t/db_dependent/Koha/Item.t >@@ -213,7 +213,7 @@ subtest 'bundle_host tests' => sub { > }; > > subtest 'add_to_bundle tests' => sub { >- plan tests => 3; >+ plan tests => 6; > > $schema->storage->txn_begin; > >@@ -223,6 +223,10 @@ subtest 'add_to_bundle tests' => sub { > my $bundle_item1 = $builder->build_sample_item(); > my $bundle_item2 = $builder->build_sample_item(); > >+ throws_ok { $host_item->add_to_bundle($host_item) } >+ 'Koha::Exceptions::Item::Bundle::IsBundle', >+ 'Exception thrown if you try to add the item to itself'; >+ > ok($host_item->add_to_bundle($bundle_item1), 'bundle_item1 added to bundle'); > is($bundle_item1->notforloan, 1, 'add_to_bundle sets notforloan to BundleNotLoanValue'); > >@@ -230,6 +234,14 @@ subtest 'add_to_bundle tests' => sub { > 'Koha::Exceptions::Object::DuplicateID', > 'Exception thrown if you try to add the same item twice'; > >+ throws_ok { $bundle_item1->add_to_bundle($bundle_item2) } >+ 'Koha::Exceptions::Item::Bundle::IsBundle', >+ 'Exception thrown if you try to add an item to a bundled item'; >+ >+ throws_ok { $bundle_item2->add_to_bundle($host_item) } >+ 'Koha::Exceptions::Item::Bundle::IsBundle', >+ 'Exception thrown if you try to add a bundle host to a bundle item'; >+ > $schema->storage->txn_rollback; > }; > >-- >2.30.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 31080
:
136975
|
137053
|
137054
|
140908
|
140909
|
143991
|
143992
|
144054
|
144055