Bug 24213: Add tests

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
This commit is contained in:
Jonathan Druart 2019-12-11 09:39:15 +01:00 committed by Joy Nelson
parent ce42283e45
commit d3462a97cc
1 changed files with 24 additions and 1 deletions

View File

@ -17,7 +17,7 @@
use Modern::Perl;
use Test::More tests => 17;
use Test::More tests => 18;
use Test::Exception;
use Test::Warn;
use DateTime;
@ -737,3 +737,26 @@ subtest 'unblessed_all_relateds' => sub {
$schema->storage->txn_rollback;
};
subtest 'get_from_storage' => sub {
plan tests => 4;
$schema->storage->txn_begin;
my $biblio = $builder->build_sample_biblio;
my $old_title = $biblio->title;
my $new_title = 'new_title';
Koha::Biblios->find( $biblio->biblionumber )->title($new_title)->store;
is( $biblio->title, $old_title, 'current $biblio should not be modified' );
is( $biblio->get_from_storage->title,
$new_title, 'get_from_storage should return an updated object' );
Koha::Biblios->find( $biblio->biblionumber )->delete;
is( ref($biblio), 'Koha::Biblio', 'current $biblio should not be deleted' );
is( $biblio->get_from_storage, undef,
'get_from_storage should return undef if the object has been deleted' );
$schema->storage->txn_rollback;
};