Bug 38751: Add tests
prove t/db_dependent/Koha/ILL/Request.t Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
parent
9fc470c0a8
commit
2a6bc075f6
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
use Modern::Perl;
|
||||
|
||||
use Test::More tests => 4;
|
||||
use Test::More tests => 5;
|
||||
use Test::MockModule;
|
||||
|
||||
use Koha::ILL::Requests;
|
||||
|
|
@ -68,6 +68,55 @@ subtest 'patron() tests' => sub {
|
|||
$schema->storage->txn_rollback;
|
||||
};
|
||||
|
||||
subtest 'extended_attributes() tests' => sub {
|
||||
|
||||
plan tests => 4;
|
||||
|
||||
$schema->storage->txn_begin;
|
||||
|
||||
my $request = $builder->build_object( { class => 'Koha::ILL::Requests' } );
|
||||
|
||||
is(
|
||||
$request->extended_attributes->count, 0,
|
||||
'extended_attributes() returns empty if no extended attributes are set'
|
||||
);
|
||||
|
||||
my $attribute = $builder->build_object(
|
||||
{
|
||||
class => 'Koha::ILL::Request::Attributes',
|
||||
value => {
|
||||
illrequest_id => $request->illrequest_id,
|
||||
type => 'custom_attribute',
|
||||
value => 'custom_value'
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
is_deeply(
|
||||
$request->extended_attributes->next, $attribute,
|
||||
'extended_attributes() returns empty if no extended attributes are set'
|
||||
);
|
||||
|
||||
$request->extended_attributes(
|
||||
[
|
||||
{ type => 'type', value => 'type_value' },
|
||||
{ type => 'type2', value => 'type2_value' },
|
||||
]
|
||||
);
|
||||
|
||||
is(
|
||||
$request->extended_attributes->count, 3,
|
||||
'extended_attributes() returns the correct amount of attributes'
|
||||
);
|
||||
|
||||
is(
|
||||
$request->extended_attributes->find( { type => 'type' } )->value, 'type_value',
|
||||
'extended_attributes() contains the correct attribute'
|
||||
);
|
||||
|
||||
$schema->storage->txn_rollback;
|
||||
};
|
||||
|
||||
subtest 'get_type_disclaimer_value() tests' => sub {
|
||||
|
||||
plan tests => 2;
|
||||
|
|
|
|||
Loading…
Reference in New Issue