|
Lines 31-37
BEGIN {
Link Here
|
| 31 |
|
31 |
|
| 32 |
subtest 'yaml_preference() tests' => sub { |
32 |
subtest 'yaml_preference() tests' => sub { |
| 33 |
|
33 |
|
| 34 |
plan tests => 3; |
34 |
plan tests => 6; |
| 35 |
|
35 |
|
| 36 |
my $data = [ 'uno', 'dos', { 'tres' => 'cuatro' } ]; |
36 |
my $data = [ 'uno', 'dos', { 'tres' => 'cuatro' } ]; |
| 37 |
|
37 |
|
|
Lines 49-54
subtest 'yaml_preference() tests' => sub {
Link Here
|
| 49 |
'Invalid YAML on syspref throws a warning'; |
49 |
'Invalid YAML on syspref throws a warning'; |
| 50 |
is( $pref, undef, 'Invalid YAML on syspref makes it return undef' ); |
50 |
is( $pref, undef, 'Invalid YAML on syspref makes it return undef' ); |
| 51 |
|
51 |
|
|
|
52 |
$context->mock( 'preference', sub { return '{ a : 1 }' }); |
| 53 |
is( ref( C4::Context->new->yaml_preference('ItemsDeniedRenewal') ), 'HASH', 'Got a hash as expected' ); |
| 54 |
$context->mock( 'preference', sub { return '[ 1, 2 ]' }); |
| 55 |
warning_like { $pref = C4::Context->new->yaml_preference('ITEMSDENIEDRENEWAL') } qr/Hashref expected/, 'Array not accepted for ItemsDeniedRenewal'; |
| 56 |
is( $pref, undef, 'Returned undef' ); |
| 57 |
|
| 52 |
$context->unmock( 'preference' ); |
58 |
$context->unmock( 'preference' ); |
| 53 |
}; |
59 |
}; |
| 54 |
|
60 |
|
| 55 |
- |
|
|