|
Lines 19-25
Link Here
|
| 19 |
|
19 |
|
| 20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
| 21 |
|
21 |
|
| 22 |
use Test::More tests => 4; |
22 |
use Test::More tests => 5; |
| 23 |
use Test::MockModule; |
23 |
use Test::MockModule; |
| 24 |
|
24 |
|
| 25 |
use Koha::ILL::Requests; |
25 |
use Koha::ILL::Requests; |
|
Lines 68-73
subtest 'patron() tests' => sub {
Link Here
|
| 68 |
$schema->storage->txn_rollback; |
68 |
$schema->storage->txn_rollback; |
| 69 |
}; |
69 |
}; |
| 70 |
|
70 |
|
|
|
71 |
subtest 'extended_attributes() tests' => sub { |
| 72 |
|
| 73 |
plan tests => 4; |
| 74 |
|
| 75 |
$schema->storage->txn_begin; |
| 76 |
|
| 77 |
my $request = $builder->build_object( { class => 'Koha::ILL::Requests' } ); |
| 78 |
|
| 79 |
is( |
| 80 |
$request->extended_attributes->count, 0, |
| 81 |
'extended_attributes() returns empty if no extended attributes are set' |
| 82 |
); |
| 83 |
|
| 84 |
my $attribute = $builder->build_object( |
| 85 |
{ |
| 86 |
class => 'Koha::ILL::Request::Attributes', |
| 87 |
value => { |
| 88 |
illrequest_id => $request->illrequest_id, |
| 89 |
type => 'custom_attribute', |
| 90 |
value => 'custom_value' |
| 91 |
} |
| 92 |
} |
| 93 |
); |
| 94 |
|
| 95 |
is_deeply( |
| 96 |
$request->extended_attributes->next, $attribute, |
| 97 |
'extended_attributes() returns empty if no extended attributes are set' |
| 98 |
); |
| 99 |
|
| 100 |
$request->extended_attributes([ |
| 101 |
{ type => 'type', value => 'type_value' }, |
| 102 |
{ type => 'type2', value => 'type2_value' }, |
| 103 |
]); |
| 104 |
|
| 105 |
is( |
| 106 |
$request->extended_attributes->count, 3, |
| 107 |
'extended_attributes() returns the correct amount of attributes' |
| 108 |
); |
| 109 |
|
| 110 |
is( |
| 111 |
$request->extended_attributes->find({ type => 'type' })->value, 'type_value', |
| 112 |
'extended_attributes() contains the correct attribute' |
| 113 |
); |
| 114 |
|
| 115 |
$schema->storage->txn_rollback; |
| 116 |
}; |
| 117 |
|
| 71 |
subtest 'get_type_disclaimer_value() tests' => sub { |
118 |
subtest 'get_type_disclaimer_value() tests' => sub { |
| 72 |
|
119 |
|
| 73 |
plan tests => 2; |
120 |
plan tests => 2; |
| 74 |
- |
|
|