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

(-)a/t/db_dependent/Koha/Patron/Attribute.t (-2 / +38 lines)
Lines 33-39 my $builder = t::lib::TestBuilder->new; Link Here
33
33
34
subtest 'store() tests' => sub {
34
subtest 'store() tests' => sub {
35
35
36
    plan tests => 2;
36
    plan tests => 3;
37
37
38
    subtest 'repeatable attributes tests' => sub {
38
    subtest 'repeatable attributes tests' => sub {
39
39
Lines 178-183 subtest 'store() tests' => sub { Link Here
178
178
179
        $schema->storage->txn_rollback;
179
        $schema->storage->txn_rollback;
180
    };
180
    };
181
182
    subtest 'invalid type tests' => sub {
183
184
        plan tests => 2;
185
186
        $schema->storage->txn_begin;
187
188
        my $patron = $builder->build_object({ class => 'Koha::Patrons' });
189
        my $attribute_type = $builder->build_object(
190
            {
191
                class => 'Koha::Patron::Attribute::Types',
192
                value => {
193
                    unique_id  => 0,
194
                    repeatable => 0
195
                }
196
            }
197
        );
198
199
        my $code = $attribute_type->code;
200
        $attribute_type->delete;
201
202
        throws_ok
203
            { Koha::Patron::Attribute->new(
204
                {
205
                    borrowernumber => $patron->borrowernumber,
206
                    code           => $code,
207
                    attribute      => 'Who knows'
208
209
                })->store;
210
            }
211
            'Koha::Exceptions::Patron::Attribute::InvalidType',
212
            'Exception thrown on invalid attribute code';
213
214
        is( $@->type, $code, 'type exception parameter passed'  );
215
216
        $schema->storage->txn_rollback;
217
    };
181
};
218
};
182
219
183
subtest 'type() tests' => sub {
220
subtest 'type() tests' => sub {
184
- 

Return to bug 27858