Bug 31005: Unit test
Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> (cherry picked from commit39c3943076) Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> (cherry picked from commit2dbf1bf80f) Signed-off-by: Arthur Suzuki <arthur.suzuki@biblibre.com>
This commit is contained in:
parent
aee21ea245
commit
e15a421dae
|
|
@ -371,7 +371,7 @@ subtest 'is_superlibrarian() tests' => sub {
|
|||
|
||||
subtest 'extended_attributes' => sub {
|
||||
|
||||
plan tests => 15;
|
||||
plan tests => 16;
|
||||
|
||||
my $schema = Koha::Database->new->schema;
|
||||
$schema->storage->txn_begin;
|
||||
|
|
@ -642,14 +642,14 @@ subtest 'extended_attributes' => sub {
|
|||
my $attribute_type_1 = $builder->build_object(
|
||||
{
|
||||
class => 'Koha::Patron::Attribute::Types',
|
||||
value => { mandatory => 1, class => 'a' }
|
||||
value => { mandatory => 1, class => 'a', category_code => undef }
|
||||
}
|
||||
);
|
||||
|
||||
my $attribute_type_2 = $builder->build_object(
|
||||
{
|
||||
class => 'Koha::Patron::Attribute::Types',
|
||||
value => { mandatory => 0, class => 'a' }
|
||||
value => { mandatory => 0, class => 'a', category_code => undef }
|
||||
}
|
||||
);
|
||||
|
||||
|
|
@ -682,6 +682,41 @@ subtest 'extended_attributes' => sub {
|
|||
|
||||
};
|
||||
|
||||
subtest 'limited category mandatory attributes tests' => sub {
|
||||
|
||||
plan tests => 2;
|
||||
|
||||
$schema->storage->txn_begin;
|
||||
Koha::Patron::Attribute::Types->search->delete;
|
||||
|
||||
my $patron = $builder->build_object({ class => 'Koha::Patrons' });
|
||||
|
||||
my $attribute_type_1 = $builder->build_object(
|
||||
{
|
||||
class => 'Koha::Patron::Attribute::Types',
|
||||
value => { mandatory => 1, class => 'a', category_code => $patron->categorycode }
|
||||
}
|
||||
);
|
||||
|
||||
$patron->extended_attributes(
|
||||
[
|
||||
{ code => $attribute_type_1->code, attribute => 'a' }
|
||||
]
|
||||
);
|
||||
|
||||
is( $patron->extended_attributes->count, 1, 'Extended attributes succeeded' );
|
||||
|
||||
$patron = $builder->build_object({ class => 'Koha::Patrons' });
|
||||
# new patron, new category - they shouldn't be required to have any attributes
|
||||
|
||||
|
||||
ok( $patron->extended_attributes([]), "We can set no attributes, mandatory attribute for other category not required");
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
subtest 'can_log_into() tests' => sub {
|
||||
|
|
|
|||
Loading…
Reference in New Issue