|
Lines 17-23
Link Here
|
| 17 |
|
17 |
|
| 18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
| 19 |
|
19 |
|
| 20 |
use Test::More tests => 1; |
20 |
use Test::More tests => 2; |
| 21 |
use Test::Exception; |
21 |
use Test::Exception; |
| 22 |
|
22 |
|
| 23 |
use Koha::Database; |
23 |
use Koha::Database; |
|
Lines 80-82
subtest 'anonymize() tests' => sub {
Link Here
|
| 80 |
|
80 |
|
| 81 |
$schema->storage->txn_rollback; |
81 |
$schema->storage->txn_rollback; |
| 82 |
}; |
82 |
}; |
| 83 |
- |
83 |
|
|
|
84 |
subtest 'biblio() tests' => sub { |
| 85 |
|
| 86 |
plan tests => 3; |
| 87 |
|
| 88 |
$schema->storage->txn_begin; |
| 89 |
|
| 90 |
my $hold_1 = $builder->build_object( |
| 91 |
{ |
| 92 |
class => 'Koha::Old::Holds', |
| 93 |
value => { biblionumber => undef } |
| 94 |
} |
| 95 |
); |
| 96 |
|
| 97 |
is( $hold_1->biblio, undef, 'Old hold has no biblionumber, returns undef' ); |
| 98 |
|
| 99 |
my $hold_2 = $builder->build_object( |
| 100 |
{ |
| 101 |
class => 'Koha::Old::Holds', |
| 102 |
value => { biblionumber => '' } |
| 103 |
} |
| 104 |
); |
| 105 |
|
| 106 |
is( $hold_1->biblio, undef, 'Old hold has empty biblionumber, returns undef' ); |
| 107 |
|
| 108 |
my $biblio = $builder->build_object( { class => 'Koha::Biblios' } ); |
| 109 |
|
| 110 |
my $hold_3 = $builder->build_object( |
| 111 |
{ |
| 112 |
class => 'Koha::Old::Holds', |
| 113 |
value => { biblionumber => $biblio->biblionumber } |
| 114 |
} |
| 115 |
); |
| 116 |
|
| 117 |
is_deeply( $hold_3->biblio->unblessed, $biblio->unblessed, 'Old hold has a biblionumber, returns a biblio object' ); |
| 118 |
|
| 119 |
$schema->storage->txn_rollback; |
| 120 |
}; |