View | Details | Raw Unified | Return to bug 38751
Collapse All | Expand All

(-)a/t/db_dependent/Koha/ILL/Request.t (-2 / +50 lines)
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
        [
102
            { type => 'type',  value => 'type_value' },
103
            { type => 'type2', value => 'type2_value' },
104
        ]
105
    );
106
107
    is(
108
        $request->extended_attributes->count, 3,
109
        'extended_attributes() returns the correct amount of attributes'
110
    );
111
112
    is(
113
        $request->extended_attributes->find( { type => 'type' } )->value, 'type_value',
114
        'extended_attributes() contains the correct attribute'
115
    );
116
117
    $schema->storage->txn_rollback;
118
};
119
71
subtest 'get_type_disclaimer_value() tests' => sub {
120
subtest 'get_type_disclaimer_value() tests' => sub {
72
121
73
    plan tests => 2;
122
    plan tests => 2;
74
- 

Return to bug 38751