|
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 => 57; |
28 |
use Test::More tests => 53; |
| 29 |
|
29 |
|
| 30 |
use t::lib::TestBuilder; |
30 |
use t::lib::TestBuilder; |
| 31 |
|
31 |
|
|
Lines 94-105
my $attributes = [
Link Here
|
| 94 |
{ |
94 |
{ |
| 95 |
value => 'my attribute1', |
95 |
value => 'my attribute1', |
| 96 |
code => $attribute_type1->code(), |
96 |
code => $attribute_type1->code(), |
| 97 |
password => 'my password1', |
|
|
| 98 |
}, |
97 |
}, |
| 99 |
{ |
98 |
{ |
| 100 |
value => 'my attribute2', |
99 |
value => 'my attribute2', |
| 101 |
code => $attribute_type2->code(), |
100 |
code => $attribute_type2->code(), |
| 102 |
password => 'my password2', |
|
|
| 103 |
}, |
101 |
}, |
| 104 |
{ |
102 |
{ |
| 105 |
value => 'my attribute limited', |
103 |
value => 'my attribute limited', |
|
Lines 124-134
is( @$borrower_attributes, 3, 'GetBorrowerAttributes returns the correct number
Link Here
|
| 124 |
is( $borrower_attributes->[0]->{code}, $attributes->[0]->{code}, 'SetBorrowerAttributes stores the correct code correctly' ); |
122 |
is( $borrower_attributes->[0]->{code}, $attributes->[0]->{code}, 'SetBorrowerAttributes stores the correct code correctly' ); |
| 125 |
is( $borrower_attributes->[0]->{description}, $attribute_type1->description(), 'SetBorrowerAttributes stores the field description correctly' ); |
123 |
is( $borrower_attributes->[0]->{description}, $attribute_type1->description(), 'SetBorrowerAttributes stores the field description correctly' ); |
| 126 |
is( $borrower_attributes->[0]->{value}, $attributes->[0]->{value}, 'SetBorrowerAttributes stores the field value correctly' ); |
124 |
is( $borrower_attributes->[0]->{value}, $attributes->[0]->{value}, 'SetBorrowerAttributes stores the field value correctly' ); |
| 127 |
is( $borrower_attributes->[0]->{password}, $attributes->[0]->{password}, 'SetBorrowerAttributes stores the field password correctly' ); |
|
|
| 128 |
is( $borrower_attributes->[1]->{code}, $attributes->[1]->{code}, 'SetBorrowerAttributes stores the field code correctly' ); |
125 |
is( $borrower_attributes->[1]->{code}, $attributes->[1]->{code}, 'SetBorrowerAttributes stores the field code correctly' ); |
| 129 |
is( $borrower_attributes->[1]->{description}, $attribute_type2->description(), 'SetBorrowerAttributes stores the field description correctly' ); |
126 |
is( $borrower_attributes->[1]->{description}, $attribute_type2->description(), 'SetBorrowerAttributes stores the field description correctly' ); |
| 130 |
is( $borrower_attributes->[1]->{value}, $attributes->[1]->{value}, 'SetBorrowerAttributes stores the field value correctly' ); |
127 |
is( $borrower_attributes->[1]->{value}, $attributes->[1]->{value}, 'SetBorrowerAttributes stores the field value correctly' ); |
| 131 |
is( $borrower_attributes->[1]->{password}, $attributes->[1]->{password}, 'SetBorrowerAttributes stores the field password correctly' ); |
|
|
| 132 |
$borrower_attributes = C4::Members::Attributes::GetBorrowerAttributes($borrowernumber); |
128 |
$borrower_attributes = C4::Members::Attributes::GetBorrowerAttributes($borrowernumber); |
| 133 |
is( @$borrower_attributes, 3, 'GetBorrowerAttributes returns the correct number of borrower attributes' ); |
129 |
is( @$borrower_attributes, 3, 'GetBorrowerAttributes returns the correct number of borrower attributes' ); |
| 134 |
|
130 |
|
|
Lines 136-147
$attributes = [
Link Here
|
| 136 |
{ |
132 |
{ |
| 137 |
value => 'my attribute1', |
133 |
value => 'my attribute1', |
| 138 |
code => $attribute_type1->code(), |
134 |
code => $attribute_type1->code(), |
| 139 |
password => 'my password1', |
|
|
| 140 |
}, |
135 |
}, |
| 141 |
{ |
136 |
{ |
| 142 |
value => 'my attribute2', |
137 |
value => 'my attribute2', |
| 143 |
code => $attribute_type2->code(), |
138 |
code => $attribute_type2->code(), |
| 144 |
password => 'my password2', |
|
|
| 145 |
} |
139 |
} |
| 146 |
]; |
140 |
]; |
| 147 |
C4::Members::Attributes::SetBorrowerAttributes($borrowernumber, $attributes); |
141 |
C4::Members::Attributes::SetBorrowerAttributes($borrowernumber, $attributes); |
|
Lines 170-176
is( $attribute_value, $attributes->[1]->{value}, 'GetBorrowerAttributeValue retu
Link Here
|
| 170 |
my $attribute = { |
164 |
my $attribute = { |
| 171 |
attribute => 'my attribute3', |
165 |
attribute => 'my attribute3', |
| 172 |
code => $attribute_type1->code(), |
166 |
code => $attribute_type1->code(), |
| 173 |
password => 'my password3', |
|
|
| 174 |
}; |
167 |
}; |
| 175 |
C4::Members::Attributes::UpdateBorrowerAttribute($borrowernumber, $attribute); |
168 |
C4::Members::Attributes::UpdateBorrowerAttribute($borrowernumber, $attribute); |
| 176 |
$borrower_attributes = C4::Members::Attributes::GetBorrowerAttributes($borrowernumber); |
169 |
$borrower_attributes = C4::Members::Attributes::GetBorrowerAttributes($borrowernumber); |
|
Lines 178-184
is( @$borrower_attributes, 3, 'UpdateBorrowerAttribute does not change the numbe
Link Here
|
| 178 |
is( $borrower_attributes->[0]->{code}, $attribute->{code}, 'UpdateBorrowerAttribute updates the field code correctly' ); |
171 |
is( $borrower_attributes->[0]->{code}, $attribute->{code}, 'UpdateBorrowerAttribute updates the field code correctly' ); |
| 179 |
is( $borrower_attributes->[0]->{description}, $attribute_type1->description(), 'UpdateBorrowerAttribute updates the field description correctly' ); |
172 |
is( $borrower_attributes->[0]->{description}, $attribute_type1->description(), 'UpdateBorrowerAttribute updates the field description correctly' ); |
| 180 |
is( $borrower_attributes->[0]->{value}, $attribute->{attribute}, 'UpdateBorrowerAttribute updates the field value correctly' ); |
173 |
is( $borrower_attributes->[0]->{value}, $attribute->{attribute}, 'UpdateBorrowerAttribute updates the field value correctly' ); |
| 181 |
is( $borrower_attributes->[0]->{password}, $attribute->{password}, 'UpdateBorrowerAttributes updates the field password correctly' ); |
|
|
| 182 |
|
174 |
|
| 183 |
|
175 |
|
| 184 |
my $check_uniqueness = C4::Members::Attributes::CheckUniqueness(); |
176 |
my $check_uniqueness = C4::Members::Attributes::CheckUniqueness(); |
|
Lines 226-232
is( @$borrower_attributes, 2, 'DeleteBorrowerAttribute deletes a borrower attrib
Link Here
|
| 226 |
is( $borrower_attributes->[0]->{code}, $attributes->[1]->{code}, 'DeleteBorrowerAttribute deletes the correct entry'); |
218 |
is( $borrower_attributes->[0]->{code}, $attributes->[1]->{code}, 'DeleteBorrowerAttribute deletes the correct entry'); |
| 227 |
is( $borrower_attributes->[0]->{description}, $attribute_type2->description(), 'DeleteBorrowerAttribute deletes the correct entry'); |
219 |
is( $borrower_attributes->[0]->{description}, $attribute_type2->description(), 'DeleteBorrowerAttribute deletes the correct entry'); |
| 228 |
is( $borrower_attributes->[0]->{value}, $attributes->[1]->{value}, 'DeleteBorrowerAttribute deletes the correct entry'); |
220 |
is( $borrower_attributes->[0]->{value}, $attributes->[1]->{value}, 'DeleteBorrowerAttribute deletes the correct entry'); |
| 229 |
is( $borrower_attributes->[0]->{password}, $attributes->[1]->{password}, 'DeleteBorrowerAttribute deletes the correct entry'); |
|
|
| 230 |
|
221 |
|
| 231 |
C4::Members::Attributes::DeleteBorrowerAttribute($borrowernumber, $attributes->[1]); |
222 |
C4::Members::Attributes::DeleteBorrowerAttribute($borrowernumber, $attributes->[1]); |
| 232 |
$borrower_attributes = C4::Members::Attributes::GetBorrowerAttributes($borrowernumber); |
223 |
$borrower_attributes = C4::Members::Attributes::GetBorrowerAttributes($borrowernumber); |
| 233 |
- |
|
|