Lines 339-350
subtest 'Date handling' => sub {
Link Here
|
339 |
}; |
339 |
}; |
340 |
|
340 |
|
341 |
subtest 'Default values' => sub { |
341 |
subtest 'Default values' => sub { |
342 |
plan tests => 2; |
342 |
plan tests => 3; |
|
|
343 |
|
343 |
$builder = t::lib::TestBuilder->new; |
344 |
$builder = t::lib::TestBuilder->new; |
344 |
my $item = $builder->build( { source => 'Item' } ); |
345 |
my $item = $builder->build( { source => 'Item' } ); |
345 |
is( $item->{more_subfields_xml}, undef, 'This xml field should be undef' ); |
346 |
is( $item->{more_subfields_xml}, undef, 'This xml field should be undef' ); |
346 |
$item = $builder->build( { source => 'Item', value => { more_subfields_xml => 'some xml' } } ); |
347 |
$item = $builder->build( { source => 'Item', value => { more_subfields_xml => 'some xml' } } ); |
347 |
is( $item->{more_subfields_xml}, 'some xml', 'Default should not overwrite assigned value' ); |
348 |
is( $item->{more_subfields_xml}, 'some xml', 'Default should not overwrite assigned value' ); |
|
|
349 |
|
350 |
subtest 'generated dynamically (coderef)' => sub { |
351 |
plan tests => 2; |
352 |
my $patron = $builder->build_object({ class => 'Koha::Patrons' }); |
353 |
like( $patron->category->category_type, qr{^(A|C|S|I|P|)$}, ); |
354 |
|
355 |
my $patron_category_X = $builder->build_object({ class => 'Koha::Patron::Categories', value => { category_type => 'X' } }); |
356 |
$patron = $builder->build_object({ class => 'Koha::Patrons', value => {categorycode => $patron_category_X->categorycode} }); |
357 |
is( $patron->category->category_type, 'X', ); |
358 |
}; |
348 |
}; |
359 |
}; |
349 |
|
360 |
|
350 |
subtest 'build_object() tests' => sub { |
361 |
subtest 'build_object() tests' => sub { |