|
Lines 157-240
subtest 'store() unique_id attributes tests' => sub {
Link Here
|
| 157 |
$schema->storage->txn_rollback; |
157 |
$schema->storage->txn_rollback; |
| 158 |
}; |
158 |
}; |
| 159 |
|
159 |
|
| 160 |
subtest 'opac_display() tests' => sub { |
|
|
| 161 |
|
| 162 |
plan tests => 2; |
| 163 |
|
| 164 |
$schema->storage->txn_begin; |
| 165 |
|
| 166 |
my $patron |
| 167 |
= $builder->build( { source => 'Borrower' } )->{borrowernumber}; |
| 168 |
my $attribute_type_1 = $builder->build( |
| 169 |
{ source => 'BorrowerAttributeType', |
| 170 |
value => { opac_display => 1 } |
| 171 |
} |
| 172 |
); |
| 173 |
|
| 174 |
my $attribute_1 = Koha::Patron::Attribute->new( |
| 175 |
{ borrowernumber => $patron, |
| 176 |
code => $attribute_type_1->{code}, |
| 177 |
attribute => $patron |
| 178 |
} |
| 179 |
); |
| 180 |
is( $attribute_1->opac_display, 1, '->opac_display returns 1' ); |
| 181 |
|
| 182 |
my $attribute_type_2 = $builder->build( |
| 183 |
{ source => 'BorrowerAttributeType', |
| 184 |
value => { opac_display => 0 } |
| 185 |
} |
| 186 |
); |
| 187 |
|
| 188 |
my $attribute_2 = Koha::Patron::Attribute->new( |
| 189 |
{ borrowernumber => $patron, |
| 190 |
code => $attribute_type_2->{code}, |
| 191 |
attribute => $patron |
| 192 |
} |
| 193 |
); |
| 194 |
is( $attribute_2->opac_display, 0, '->opac_display returns 0' ); |
| 195 |
|
| 196 |
$schema->storage->txn_rollback; |
| 197 |
}; |
| 198 |
|
| 199 |
subtest 'opac_editable() tests' => sub { |
| 200 |
|
| 201 |
plan tests => 2; |
| 202 |
|
| 203 |
$schema->storage->txn_begin; |
| 204 |
|
| 205 |
my $patron |
| 206 |
= $builder->build( { source => 'Borrower' } )->{borrowernumber}; |
| 207 |
my $attribute_type_1 = $builder->build( |
| 208 |
{ source => 'BorrowerAttributeType', |
| 209 |
value => { opac_editable => 1 } |
| 210 |
} |
| 211 |
); |
| 212 |
|
| 213 |
my $attribute_1 = Koha::Patron::Attribute->new( |
| 214 |
{ borrowernumber => $patron, |
| 215 |
code => $attribute_type_1->{code}, |
| 216 |
attribute => $patron |
| 217 |
} |
| 218 |
); |
| 219 |
is( $attribute_1->opac_editable, 1, '->opac_editable returns 1' ); |
| 220 |
|
| 221 |
my $attribute_type_2 = $builder->build( |
| 222 |
{ source => 'BorrowerAttributeType', |
| 223 |
value => { opac_editable => 0 } |
| 224 |
} |
| 225 |
); |
| 226 |
|
| 227 |
my $attribute_2 = Koha::Patron::Attribute->new( |
| 228 |
{ borrowernumber => $patron, |
| 229 |
code => $attribute_type_2->{code}, |
| 230 |
attribute => $patron |
| 231 |
} |
| 232 |
); |
| 233 |
is( $attribute_2->opac_editable, 0, '->opac_editable returns 0' ); |
| 234 |
|
| 235 |
$schema->storage->txn_rollback; |
| 236 |
}; |
| 237 |
|
| 238 |
subtest 'type() tests' => sub { |
160 |
subtest 'type() tests' => sub { |
| 239 |
|
161 |
|
| 240 |
plan tests => 4; |
162 |
plan tests => 4; |
| 241 |
- |
|
|