View | Details | Raw Unified | Return to bug 29033
Collapse All | Expand All

(-)a/C4/Context.pm (+16 lines)
Lines 351-356 sub yaml_preference { Link Here
351
    return $yaml;
351
    return $yaml;
352
}
352
}
353
353
354
=head2 multivalue_preference
355
356
Retrieves the required system preference value, and splits it
357
into pieces using the I<pipe> (|) symbol as separator.
358
359
=cut
360
361
sub multivalue_preference {
362
    my ( $self, $preference ) = @_;
363
364
    my $syspref = $self->preference($preference) // q{};
365
    my $values  = [ split qr{\|}, $syspref ];
366
367
    return $values;
368
}
369
354
=head2 enable_syspref_cache
370
=head2 enable_syspref_cache
355
371
356
  C4::Context->enable_syspref_cache();
372
  C4::Context->enable_syspref_cache();
(-)a/t/Context.t (-2 / +15 lines)
Lines 18-24 Link Here
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
use DBI;
20
use DBI;
21
use Test::More tests => 33;
21
use Test::More tests => 34;
22
use Test::MockModule;
22
use Test::MockModule;
23
use Test::Warn;
23
use Test::Warn;
24
use YAML::XS;
24
use YAML::XS;
Lines 52-57 subtest 'yaml_preference() tests' => sub { Link Here
52
    $context->unmock( 'preference' );
52
    $context->unmock( 'preference' );
53
};
53
};
54
54
55
subtest 'multivalue_preference() tests' => sub {
56
57
    plan tests => 3;
58
59
    t::lib::Mocks::mock_preference( 'MultiValuedSyspref', '' );
60
    is_deeply( C4::Context->multivalue_preference('MultiValuedSyspref'), [] );
61
62
    t::lib::Mocks::mock_preference( 'MultiValuedSyspref', 'some' );
63
    is_deeply( C4::Context->multivalue_preference('MultiValuedSyspref'), ['some'] );
64
65
    t::lib::Mocks::mock_preference( 'MultiValuedSyspref', 'some|more|values' );
66
    is_deeply( C4::Context->multivalue_preference('MultiValuedSyspref'), ['some','more','values'] );
67
};
68
55
subtest 'needs_install() tests' => sub {
69
subtest 'needs_install() tests' => sub {
56
70
57
    plan tests => 2;
71
    plan tests => 2;
58
- 

Return to bug 29033