|
Lines 19-25
Link Here
|
| 19 |
|
19 |
|
| 20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
| 21 |
|
21 |
|
| 22 |
use Test::More tests => 4; |
22 |
use Test::More tests => 5; |
| 23 |
|
23 |
|
| 24 |
use t::lib::TestBuilder; |
24 |
use t::lib::TestBuilder; |
| 25 |
use Test::Exception; |
25 |
use Test::Exception; |
|
Lines 235-238
subtest 'opac_editable() tests' => sub {
Link Here
|
| 235 |
$schema->storage->txn_rollback; |
235 |
$schema->storage->txn_rollback; |
| 236 |
}; |
236 |
}; |
| 237 |
|
237 |
|
|
|
238 |
subtest 'type() tests' => sub { |
| 239 |
|
| 240 |
plan tests => 4; |
| 241 |
|
| 242 |
$schema->storage->txn_begin; |
| 243 |
|
| 244 |
my $patron |
| 245 |
= $builder->build( { source => 'Borrower' } )->{borrowernumber}; |
| 246 |
my $attr_type = $builder->build( { source => 'BorrowerAttributeType' } ); |
| 247 |
my $attribute = Koha::Patron::Attribute->new( |
| 248 |
{ borrowernumber => $patron, |
| 249 |
code => $attr_type->{code}, |
| 250 |
attribute => $patron |
| 251 |
} |
| 252 |
); |
| 253 |
|
| 254 |
my $attribute_type = $attribute->type; |
| 255 |
|
| 256 |
is( ref($attribute_type), |
| 257 |
'Koha::Patron::Attribute::Type', |
| 258 |
'->type returns a Koha::Patron::Attribute::Type object' |
| 259 |
); |
| 260 |
|
| 261 |
is( $attribute_type->code, |
| 262 |
$attr_type->{code}, |
| 263 |
'->type returns the right Koha::Patron::Attribute::Type object' ); |
| 264 |
|
| 265 |
is( $attribute_type->opac_editable, |
| 266 |
$attr_type->{opac_editable}, |
| 267 |
'->type returns the right Koha::Patron::Attribute::Type object' |
| 268 |
); |
| 269 |
|
| 270 |
is( $attribute_type->opac_display, |
| 271 |
$attr_type->{opac_display}, |
| 272 |
'->type returns the right Koha::Patron::Attribute::Type object' |
| 273 |
); |
| 274 |
|
| 275 |
$schema->storage->txn_rollback; |
| 276 |
}; |
| 277 |
|
| 238 |
1; |
278 |
1; |
| 239 |
- |
|
|