|
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 344-357
subtest 'Default values' => sub {
Link Here
|
| 344 |
is( $item->{more_subfields_xml}, 'some xml', 'Default should not overwrite assigned value' ); |
344 |
is( $item->{more_subfields_xml}, 'some xml', 'Default should not overwrite assigned value' ); |
| 345 |
}; |
345 |
}; |
| 346 |
|
346 |
|
| 347 |
$schema->storage->txn_rollback; |
|
|
| 348 |
|
| 349 |
subtest 'build_object() tests' => sub { |
347 |
subtest 'build_object() tests' => sub { |
| 350 |
|
348 |
|
| 351 |
plan tests => 5; |
349 |
plan tests => 5; |
| 352 |
|
350 |
|
| 353 |
$schema->storage->txn_begin; |
|
|
| 354 |
|
| 355 |
$builder = t::lib::TestBuilder->new(); |
351 |
$builder = t::lib::TestBuilder->new(); |
| 356 |
|
352 |
|
| 357 |
my $categorycode = $builder->build( { source => 'Category' } )->{categorycode}; |
353 |
my $categorycode = $builder->build( { source => 'Category' } )->{categorycode}; |
|
Lines 368-375
subtest 'build_object() tests' => sub {
Link Here
|
| 368 |
|
364 |
|
| 369 |
is( ref($issuing_rule), 'Koha::IssuingRule', 'Type is correct' ); |
365 |
is( ref($issuing_rule), 'Koha::IssuingRule', 'Type is correct' ); |
| 370 |
is( $issuing_rule->categorycode, |
366 |
is( $issuing_rule->categorycode, |
| 371 |
$categorycode, 'Firstname correctly set' ); |
367 |
$categorycode, 'Category code correctly set' ); |
| 372 |
is( $issuing_rule->itemtype, $itemtype, 'Firstname correctly set' ); |
368 |
is( $issuing_rule->itemtype, $itemtype, 'Item type correctly set' ); |
| 373 |
|
369 |
|
| 374 |
warning_is { $issuing_rule = $builder->build_object( {} ); } |
370 |
warning_is { $issuing_rule = $builder->build_object( {} ); } |
| 375 |
{ carped => 'Missing class param' }, |
371 |
{ carped => 'Missing class param' }, |
|
Lines 377-383
subtest 'build_object() tests' => sub {
Link Here
|
| 377 |
is( $issuing_rule, undef, |
373 |
is( $issuing_rule, undef, |
| 378 |
'If the class parameter is missing, undef is returned' ); |
374 |
'If the class parameter is missing, undef is returned' ); |
| 379 |
|
375 |
|
| 380 |
$schema->storage->txn_rollback; |
|
|
| 381 |
}; |
376 |
}; |
| 382 |
|
377 |
|
| 383 |
1; |
378 |
$schema->storage->txn_rollback; |
| 384 |
- |
|
|