From b81d2e0246adb2b9f8887c89fb2cfcc7def7da69 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Tue, 29 Dec 2020 14:35:27 -0300 Subject: [PATCH] Bug 27004: Regression tests This patch introduces regression tests for the change in Koha::Checkouts::ReturnClaim->store. To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/db_dependent/Koha/Checkouts/ReturnClaim.t => FAIL: Tests fail Signed-off-by: Tomas Cohen Arazi --- t/db_dependent/Koha/Checkouts/ReturnClaim.t | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/t/db_dependent/Koha/Checkouts/ReturnClaim.t b/t/db_dependent/Koha/Checkouts/ReturnClaim.t index 7d6c3bb4cc..cb31b10f1c 100755 --- a/t/db_dependent/Koha/Checkouts/ReturnClaim.t +++ b/t/db_dependent/Koha/Checkouts/ReturnClaim.t @@ -30,7 +30,7 @@ my $builder = t::lib::TestBuilder->new; subtest "store() tests" => sub { - plan tests => 8; + plan tests => 11; $schema->storage->txn_begin; @@ -61,6 +61,23 @@ subtest "store() tests" => sub { 'Koha::Exceptions::Checkouts::ReturnClaims::NoCreatedBy', 'Exception thrown correctly'; + my $nullified_created_by = $builder->build_object( + { + class => 'Koha::Checkouts::ReturnClaims', + value => { + created_by => undef + } + } + ); + + is( $nullified_created_by->created_by, undef, 'Is undef' ); + ok( $nullified_created_by->in_storage, 'In storage' ); + is( + ref($nullified_created_by->notes('Some other note')->store), + 'Koha::Checkouts::ReturnClaim', + 'No exception, store success' + ); + is( Koha::Checkouts::ReturnClaims->search({ issue_id => $checkout->id })->count, 0, 'No claims stored' ); my $claim = Koha::Checkouts::ReturnClaim->new( -- 2.29.2