Lines 20-26
Link Here
|
20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
21 |
use utf8; |
21 |
use utf8; |
22 |
|
22 |
|
23 |
use Test::More tests => 28; |
23 |
use Test::More tests => 29; |
24 |
use Test::Exception; |
24 |
use Test::Exception; |
25 |
use Test::MockModule; |
25 |
use Test::MockModule; |
26 |
|
26 |
|
Lines 2175-2177
subtest 'is_denied_renewal' => sub {
Link Here
|
2175 |
|
2175 |
|
2176 |
$schema->storage->txn_rollback; |
2176 |
$schema->storage->txn_rollback; |
2177 |
}; |
2177 |
}; |
2178 |
- |
2178 |
|
|
|
2179 |
subtest 'current_branchtransfers relationship' => sub { |
2180 |
plan tests => 3; |
2181 |
|
2182 |
$schema->storage->txn_begin; |
2183 |
|
2184 |
my $biblio = $builder->build_sample_biblio(); |
2185 |
my $item = $builder->build_sample_item( |
2186 |
{ |
2187 |
biblionumber => $biblio->biblionumber, |
2188 |
} |
2189 |
); |
2190 |
my $transfers = $item->_result->current_branchtransfers; |
2191 |
is( ref($transfers), 'DBIx::Class::ResultSet', |
2192 |
'current_branchtransfers returns a Koha::Item::Transfers object set' ); |
2193 |
is( $transfers->count, 0, |
2194 |
"Empty Koha::Item::Transfers set returned if no return_claims" ); |
2195 |
my $transfer1 = $builder->build( |
2196 |
{ |
2197 |
source => 'Branchtransfer', |
2198 |
value => { |
2199 |
itemnumber => $item->itemnumber, |
2200 |
datearrived => dt_from_string, |
2201 |
} |
2202 |
} |
2203 |
); |
2204 |
my $transfer2 = $builder->build( |
2205 |
{ |
2206 |
source => 'Branchtransfer', |
2207 |
value => { |
2208 |
itemnumber => $item->itemnumber, |
2209 |
datearrived => undef, |
2210 |
datecancelled => dt_from_string, |
2211 |
} |
2212 |
} |
2213 |
); |
2214 |
my $transfer3 = $builder->build( |
2215 |
{ |
2216 |
source => 'Branchtransfer', |
2217 |
value => { |
2218 |
itemnumber => $item->itemnumber, |
2219 |
datearrived => undef, |
2220 |
datecancelled => undef, |
2221 |
} |
2222 |
} |
2223 |
); |
2224 |
|
2225 |
is( $item->_result->current_branchtransfers()->count, |
2226 |
1, "One transfer found for item" ); |
2227 |
|
2228 |
$schema->storage->txn_rollback; |
2229 |
}; |