Lines 36-47
our $builder;
Link Here
|
36 |
|
36 |
|
37 |
|
37 |
|
38 |
subtest 'Start with some trivial tests' => sub { |
38 |
subtest 'Start with some trivial tests' => sub { |
39 |
plan tests => 6; |
39 |
plan tests => 7; |
40 |
|
40 |
|
41 |
$builder = t::lib::TestBuilder->new; |
41 |
$builder = t::lib::TestBuilder->new; |
42 |
isnt( $builder, undef, 'We got a builder' ); |
42 |
isnt( $builder, undef, 'We got a builder' ); |
43 |
|
43 |
|
44 |
is( $builder->build, undef, 'build without arguments returns undef' ); |
44 |
my $data; |
|
|
45 |
warning_like { my $data = $builder->build; } qr/.+/, 'Catch a warning'; |
46 |
is( $data, undef, 'build without arguments returns undef' ); |
45 |
is( ref( $builder->schema ), 'Koha::Schema', 'check schema' ); |
47 |
is( ref( $builder->schema ), 'Koha::Schema', 'check schema' ); |
46 |
is( ref( $builder->can('delete') ), 'CODE', 'found delete method' ); |
48 |
is( ref( $builder->can('delete') ), 'CODE', 'found delete method' ); |
47 |
|
49 |
|
Lines 391-397
subtest 'build_object() tests' => sub {
Link Here
|
391 |
}; |
393 |
}; |
392 |
|
394 |
|
393 |
subtest '->build parameter' => sub { |
395 |
subtest '->build parameter' => sub { |
394 |
plan tests => 2; |
396 |
plan tests => 3; |
395 |
|
397 |
|
396 |
# Test to make sure build() warns user of unknown parameters. |
398 |
# Test to make sure build() warns user of unknown parameters. |
397 |
warnings_are { |
399 |
warnings_are { |
Lines 409-414
subtest '->build parameter' => sub {
Link Here
|
409 |
branchcode => 'BRANCH_2' # This is wrong! |
411 |
branchcode => 'BRANCH_2' # This is wrong! |
410 |
}) |
412 |
}) |
411 |
} qr/unknown param/i, "Carp unknown parameters"; |
413 |
} qr/unknown param/i, "Carp unknown parameters"; |
|
|
414 |
|
415 |
warnings_like { |
416 |
$builder->build({ |
417 |
zource => 'Branch', # Intentional spelling error |
418 |
}) |
419 |
} qr/Source parameter not specified/, "Catch warning on missing source"; |
412 |
}; |
420 |
}; |
413 |
|
421 |
|
414 |
$schema->storage->txn_rollback; |
422 |
$schema->storage->txn_rollback; |