Bugzilla – Attachment 166790 Details for
Bug 36873
Koha::Objects->delete should accept parameters and pass them through
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 36873: Unit tests
Bug-36873-Unit-tests.patch (text/plain), 2.22 KB, created by
Tomás Cohen Arazi (tcohen)
on 2024-05-15 19:19:18 UTC
(
hide
)
Description:
Bug 36873: Unit tests
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2024-05-15 19:19:18 UTC
Size:
2.22 KB
patch
obsolete
>From a7e6369b369d25a31c4539957be69e65b3586d16 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Wed, 15 May 2024 16:12:31 -0300 >Subject: [PATCH] Bug 36873: Unit tests > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > t/db_dependent/Koha/Objects.t | 26 +++++++++++++++++++++++--- > 1 file changed, 23 insertions(+), 3 deletions(-) > >diff --git a/t/db_dependent/Koha/Objects.t b/t/db_dependent/Koha/Objects.t >index a5444fc2a84..9f4a6f03230 100755 >--- a/t/db_dependent/Koha/Objects.t >+++ b/t/db_dependent/Koha/Objects.t >@@ -29,6 +29,7 @@ use C4::Context; > use Koha::Authority::Types; > use Koha::Cities; > use Koha::Biblios; >+use Koha::Items; > use Koha::Patron::Category; > use Koha::Patron::Categories; > use Koha::Patrons; >@@ -1286,13 +1287,13 @@ subtest 'empty() tests' => sub { > > subtest 'delete() tests' => sub { > >- plan tests => 2; >+ plan tests => 3; > > $schema->storage->txn_begin; > > # Make sure no cities > warnings_are { Koha::Cities->delete }[], >- "No warnings, no Koha::City->delete called as it doesn't exist"; >+ "No warnings, no Koha::City->delete called as it doesn't exist"; > > # Mock Koha::City > my $mocked_city = Test::MockModule->new('Koha::City'); >@@ -1311,7 +1312,26 @@ subtest 'delete() tests' => sub { > my $cities = Koha::Cities->search; > $cities->next; > warnings_are { $cities->delete } >- [ "delete called!", "delete called!" ], >+ [ "delete called!", "delete called!" ], >+ "No warnings, no Koha::City->delete called as it doesn't exist"; >+ >+ my $item_id_1 = $builder->build_sample_item()->id; >+ my $item_id_2 = $builder->build_sample_item()->id; >+ >+ # Mock Koha::City >+ my $mocked_item = Test::MockModule->new('Koha::Item'); >+ $mocked_item->mock( >+ 'delete', >+ sub { >+ my ( $self, $params ) = @_; >+ warn ref($self); >+ warn $params->{skip_record_index}; >+ } >+ ); >+ my $items = Koha::Items->search( { itemnumber => [ $item_id_1, $item_id_2 ] } ); >+ >+ warning_is { $items->delete( { skip_record_index => 1 } ) } >+ [ "Koha::Item", "1", "Koha::Item", "1" ], > "No warnings, no Koha::City->delete called as it doesn't exist"; > > $schema->storage->txn_rollback; >-- >2.45.0
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 36873
:
166790
|
166791
|
166799
|
166800
|
168246
|
168247