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 <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Tomas Cohen Arazi 2020-12-29 14:35:27 -03:00 committed by Jonathan Druart
parent 5f2414686d
commit c4702149b2
1 changed files with 18 additions and 1 deletions

View File

@ -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(