Lines 25-31
use C4::Members::AttributeTypes;
Link Here
|
25 |
use Koha::Database; |
25 |
use Koha::Database; |
26 |
use t::lib::TestBuilder; |
26 |
use t::lib::TestBuilder; |
27 |
|
27 |
|
28 |
use Test::More tests => 55; |
28 |
use Test::More tests => 48; |
29 |
|
29 |
|
30 |
use_ok('C4::Members::Attributes'); |
30 |
use_ok('C4::Members::Attributes'); |
31 |
|
31 |
|
Lines 58-81
my $borrowernumber = $patron->{borrowernumber};
Link Here
|
58 |
|
58 |
|
59 |
my $attribute_type1 = C4::Members::AttributeTypes->new('my code1', 'my description1'); |
59 |
my $attribute_type1 = C4::Members::AttributeTypes->new('my code1', 'my description1'); |
60 |
$attribute_type1->unique_id(1); |
60 |
$attribute_type1->unique_id(1); |
61 |
my $attribute_types = C4::Members::Attributes::GetAttributes(); |
|
|
62 |
is( @$attribute_types, 0, 'GetAttributes returns the correct number of attribute types' ); |
63 |
$attribute_type1->store(); |
61 |
$attribute_type1->store(); |
64 |
$attribute_types = C4::Members::Attributes::GetAttributes(); |
|
|
65 |
is( @$attribute_types, 1, 'GetAttributes returns the correct number of attribute types' ); |
66 |
is( $attribute_types->[0], $attribute_type1->code(), 'GetAttributes returns the correct value for code' ); |
67 |
$attribute_types = C4::Members::Attributes::GetAttributes(1); |
68 |
is( @$attribute_types, 0, 'GetAttributes returns the correct number of attribute types with the filter opac_only' ); |
69 |
|
62 |
|
70 |
my $attribute_type2 = C4::Members::AttributeTypes->new('my code2', 'my description2'); |
63 |
my $attribute_type2 = C4::Members::AttributeTypes->new('my code2', 'my description2'); |
71 |
$attribute_type2->opac_display(1); |
64 |
$attribute_type2->opac_display(1); |
72 |
$attribute_type2->staff_searchable(1); |
65 |
$attribute_type2->staff_searchable(1); |
73 |
$attribute_type2->store(); |
66 |
$attribute_type2->store(); |
74 |
$attribute_types = C4::Members::Attributes::GetAttributes(); |
|
|
75 |
is( @$attribute_types, 2, 'GetAttributes returns the correct number of attribute types' ); |
76 |
is( $attribute_types->[1], $attribute_type2->code(), 'GetAttributes returns the correct value for code' ); |
77 |
$attribute_types = C4::Members::Attributes::GetAttributes(1); |
78 |
is( @$attribute_types, 1, 'GetAttributes returns the correct number of attribute types with the filter opac_only' ); |
79 |
|
67 |
|
80 |
my $new_library = $builder->build( { source => 'Branch' } ); |
68 |
my $new_library = $builder->build( { source => 'Branch' } ); |
81 |
my $attribute_type_limited = C4::Members::AttributeTypes->new('my code3', 'my description3'); |
69 |
my $attribute_type_limited = C4::Members::AttributeTypes->new('my code3', 'my description3'); |
82 |
- |
|
|