|
Lines 372-378
subtest 'is_superlibrarian() tests' => sub {
Link Here
|
| 372 |
|
372 |
|
| 373 |
subtest 'extended_attributes' => sub { |
373 |
subtest 'extended_attributes' => sub { |
| 374 |
|
374 |
|
| 375 |
plan tests => 15; |
375 |
plan tests => 16; |
| 376 |
|
376 |
|
| 377 |
my $schema = Koha::Database->new->schema; |
377 |
my $schema = Koha::Database->new->schema; |
| 378 |
$schema->storage->txn_begin; |
378 |
$schema->storage->txn_begin; |
|
Lines 649-662
subtest 'extended_attributes' => sub {
Link Here
|
| 649 |
my $attribute_type_1 = $builder->build_object( |
649 |
my $attribute_type_1 = $builder->build_object( |
| 650 |
{ |
650 |
{ |
| 651 |
class => 'Koha::Patron::Attribute::Types', |
651 |
class => 'Koha::Patron::Attribute::Types', |
| 652 |
value => { mandatory => 1, class => 'a' } |
652 |
value => { mandatory => 1, class => 'a', category_code => undef } |
| 653 |
} |
653 |
} |
| 654 |
); |
654 |
); |
| 655 |
|
655 |
|
| 656 |
my $attribute_type_2 = $builder->build_object( |
656 |
my $attribute_type_2 = $builder->build_object( |
| 657 |
{ |
657 |
{ |
| 658 |
class => 'Koha::Patron::Attribute::Types', |
658 |
class => 'Koha::Patron::Attribute::Types', |
| 659 |
value => { mandatory => 0, class => 'a' } |
659 |
value => { mandatory => 0, class => 'a', category_code => undef } |
| 660 |
} |
660 |
} |
| 661 |
); |
661 |
); |
| 662 |
|
662 |
|
|
Lines 689-694
subtest 'extended_attributes' => sub {
Link Here
|
| 689 |
|
689 |
|
| 690 |
}; |
690 |
}; |
| 691 |
|
691 |
|
|
|
692 |
subtest 'limited category mandatory attributes tests' => sub { |
| 693 |
|
| 694 |
plan tests => 2; |
| 695 |
|
| 696 |
$schema->storage->txn_begin; |
| 697 |
Koha::Patron::Attribute::Types->search->delete; |
| 698 |
|
| 699 |
my $patron = $builder->build_object({ class => 'Koha::Patrons' }); |
| 700 |
|
| 701 |
my $attribute_type_1 = $builder->build_object( |
| 702 |
{ |
| 703 |
class => 'Koha::Patron::Attribute::Types', |
| 704 |
value => { mandatory => 1, class => 'a', category_code => $patron->categorycode } |
| 705 |
} |
| 706 |
); |
| 707 |
|
| 708 |
$patron->extended_attributes( |
| 709 |
[ |
| 710 |
{ code => $attribute_type_1->code, attribute => 'a' } |
| 711 |
] |
| 712 |
); |
| 713 |
|
| 714 |
is( $patron->extended_attributes->count, 1, 'Extended attributes succeeded' ); |
| 715 |
|
| 716 |
$patron = $builder->build_object({ class => 'Koha::Patrons' }); |
| 717 |
# new patron, new category - they shouldn't be required to have any attributes |
| 718 |
|
| 719 |
|
| 720 |
ok( $patron->extended_attributes([]), "We can set no attributes, mandatory attribute for other category not required"); |
| 721 |
|
| 722 |
|
| 723 |
}; |
| 724 |
|
| 725 |
|
| 726 |
|
| 692 |
}; |
727 |
}; |
| 693 |
|
728 |
|
| 694 |
subtest 'can_log_into() tests' => sub { |
729 |
subtest 'can_log_into() tests' => sub { |
| 695 |
- |
|
|