Lines 369-375
subtest 'is_superlibrarian() tests' => sub {
Link Here
|
369 |
|
369 |
|
370 |
subtest 'extended_attributes' => sub { |
370 |
subtest 'extended_attributes' => sub { |
371 |
|
371 |
|
372 |
plan tests => 14; |
372 |
plan tests => 15; |
373 |
|
373 |
|
374 |
my $schema = Koha::Database->new->schema; |
374 |
my $schema = Koha::Database->new->schema; |
375 |
$schema->storage->txn_begin; |
375 |
$schema->storage->txn_begin; |
Lines 614-618
subtest 'extended_attributes' => sub {
Link Here
|
614 |
is( $patron->extended_attributes->count, 0, 'Extended attributes storing rolled back' ); |
614 |
is( $patron->extended_attributes->count, 0, 'Extended attributes storing rolled back' ); |
615 |
}; |
615 |
}; |
616 |
|
616 |
|
|
|
617 |
subtest 'globally mandatory attributes tests' => sub { |
618 |
|
619 |
plan tests => 3; |
620 |
|
621 |
my $patron = $builder->build_object({ class => 'Koha::Patrons' }); |
622 |
|
623 |
my $attribute_type_1 = $builder->build_object( |
624 |
{ |
625 |
class => 'Koha::Patron::Attribute::Types', |
626 |
value => { mandatory => 1 } |
627 |
} |
628 |
); |
629 |
|
630 |
my $attribute_type_2 = $builder->build_object( |
631 |
{ |
632 |
class => 'Koha::Patron::Attribute::Types', |
633 |
value => { mandatory => 0 } |
634 |
} |
635 |
); |
636 |
|
637 |
is( $patron->extended_attributes->count, 0, 'Patron has no extended attributes' ); |
638 |
|
639 |
throws_ok |
640 |
{ |
641 |
$patron->extended_attributes( |
642 |
[ |
643 |
{ code => $attribute_type_2->code, attribute => 'b' } |
644 |
] |
645 |
); |
646 |
} |
647 |
'Koha::Exceptions::Object::FKConstraint', |
648 |
'Exception thrown on missing mandatory attribute type'; |
649 |
|
650 |
is( $patron->extended_attributes->count, 0, 'Extended attributes storing rolled back' ); |
651 |
}; |
652 |
|
617 |
$schema->storage->txn_rollback; |
653 |
$schema->storage->txn_rollback; |
618 |
}; |
654 |
}; |
619 |
- |
|
|