|
Lines 30-38
BEGIN {
Link Here
|
| 30 |
use_ok('t::lib::TestBuilder'); |
30 |
use_ok('t::lib::TestBuilder'); |
| 31 |
} |
31 |
} |
| 32 |
|
32 |
|
| 33 |
my $schema = Koha::Database->new->schema; |
33 |
our $schema = Koha::Database->new->schema; |
| 34 |
$schema->storage->txn_begin; |
34 |
$schema->storage->txn_begin; |
| 35 |
my $builder; |
35 |
our $builder; |
| 36 |
|
36 |
|
| 37 |
|
37 |
|
| 38 |
subtest 'Start with some trivial tests' => sub { |
38 |
subtest 'Start with some trivial tests' => sub { |
|
Lines 342-355
subtest 'Default values' => sub {
Link Here
|
| 342 |
is( $item->{more_subfields_xml}, 'some xml', 'Default should not overwrite assigned value' ); |
342 |
is( $item->{more_subfields_xml}, 'some xml', 'Default should not overwrite assigned value' ); |
| 343 |
}; |
343 |
}; |
| 344 |
|
344 |
|
| 345 |
$schema->storage->txn_rollback; |
|
|
| 346 |
|
| 347 |
subtest 'build_object() tests' => sub { |
345 |
subtest 'build_object() tests' => sub { |
| 348 |
|
346 |
|
| 349 |
plan tests => 5; |
347 |
plan tests => 5; |
| 350 |
|
348 |
|
| 351 |
$schema->storage->txn_begin; |
|
|
| 352 |
|
| 353 |
$builder = t::lib::TestBuilder->new(); |
349 |
$builder = t::lib::TestBuilder->new(); |
| 354 |
|
350 |
|
| 355 |
my $categorycode = $builder->build( { source => 'Category' } )->{categorycode}; |
351 |
my $categorycode = $builder->build( { source => 'Category' } )->{categorycode}; |
|
Lines 366-373
subtest 'build_object() tests' => sub {
Link Here
|
| 366 |
|
362 |
|
| 367 |
is( ref($issuing_rule), 'Koha::IssuingRule', 'Type is correct' ); |
363 |
is( ref($issuing_rule), 'Koha::IssuingRule', 'Type is correct' ); |
| 368 |
is( $issuing_rule->categorycode, |
364 |
is( $issuing_rule->categorycode, |
| 369 |
$categorycode, 'Firstname correctly set' ); |
365 |
$categorycode, 'Category code correctly set' ); |
| 370 |
is( $issuing_rule->itemtype, $itemtype, 'Firstname correctly set' ); |
366 |
is( $issuing_rule->itemtype, $itemtype, 'Item type correctly set' ); |
| 371 |
|
367 |
|
| 372 |
warning_is { $issuing_rule = $builder->build_object( {} ); } |
368 |
warning_is { $issuing_rule = $builder->build_object( {} ); } |
| 373 |
{ carped => 'Missing class param' }, |
369 |
{ carped => 'Missing class param' }, |
|
Lines 375-381
subtest 'build_object() tests' => sub {
Link Here
|
| 375 |
is( $issuing_rule, undef, |
371 |
is( $issuing_rule, undef, |
| 376 |
'If the class parameter is missing, undef is returned' ); |
372 |
'If the class parameter is missing, undef is returned' ); |
| 377 |
|
373 |
|
| 378 |
$schema->storage->txn_rollback; |
|
|
| 379 |
}; |
374 |
}; |
| 380 |
|
375 |
|
| 381 |
1; |
376 |
$schema->storage->txn_rollback; |
| 382 |
- |
|
|