Lines 616-636
subtest 'extended_attributes' => sub {
Link Here
|
616 |
|
616 |
|
617 |
subtest 'globally mandatory attributes tests' => sub { |
617 |
subtest 'globally mandatory attributes tests' => sub { |
618 |
|
618 |
|
619 |
plan tests => 3; |
619 |
plan tests => 5; |
620 |
|
620 |
|
621 |
my $patron = $builder->build_object({ class => 'Koha::Patrons' }); |
621 |
my $patron = $builder->build_object({ class => 'Koha::Patrons' }); |
622 |
|
622 |
|
623 |
my $attribute_type_1 = $builder->build_object( |
623 |
my $attribute_type_1 = $builder->build_object( |
624 |
{ |
624 |
{ |
625 |
class => 'Koha::Patron::Attribute::Types', |
625 |
class => 'Koha::Patron::Attribute::Types', |
626 |
value => { mandatory => 1 } |
626 |
value => { mandatory => 1, class => 'a' } |
627 |
} |
627 |
} |
628 |
); |
628 |
); |
629 |
|
629 |
|
630 |
my $attribute_type_2 = $builder->build_object( |
630 |
my $attribute_type_2 = $builder->build_object( |
631 |
{ |
631 |
{ |
632 |
class => 'Koha::Patron::Attribute::Types', |
632 |
class => 'Koha::Patron::Attribute::Types', |
633 |
value => { mandatory => 0 } |
633 |
value => { mandatory => 0, class => 'a' } |
634 |
} |
634 |
} |
635 |
); |
635 |
); |
636 |
|
636 |
|
Lines 647-653
subtest 'extended_attributes' => sub {
Link Here
|
647 |
'Koha::Exceptions::Object::FKConstraint', |
647 |
'Koha::Exceptions::Object::FKConstraint', |
648 |
'Exception thrown on missing mandatory attribute type'; |
648 |
'Exception thrown on missing mandatory attribute type'; |
649 |
|
649 |
|
|
|
650 |
is( $@->value, $attribute_type_1->code, 'Exception parameters are correct' ); |
651 |
|
650 |
is( $patron->extended_attributes->count, 0, 'Extended attributes storing rolled back' ); |
652 |
is( $patron->extended_attributes->count, 0, 'Extended attributes storing rolled back' ); |
|
|
653 |
|
654 |
$patron->extended_attributes( |
655 |
[ |
656 |
{ code => $attribute_type_1->code, attribute => 'b' } |
657 |
] |
658 |
); |
659 |
|
660 |
is( $patron->extended_attributes->count, 1, 'Extended attributes succeeded' ); |
651 |
}; |
661 |
}; |
652 |
|
662 |
|
653 |
$schema->storage->txn_rollback; |
663 |
$schema->storage->txn_rollback; |
654 |
- |
|
|