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

(-)a/C4/Context.pm (+16 lines)
Lines 350-355 sub yaml_preference { Link Here
350
    return $yaml;
350
    return $yaml;
351
}
351
}
352
352
353
=head2 multivalue_preference
354
355
Retrieves the required system preference value, and splits it
356
into pieces using the I<pipe> (|) symbol as separator.
357
358
=cut
359
360
sub multivalue_preference {
361
    my ( $self, $preference ) = @_;
362
363
    my $syspref = $self->preference($preference) // q{};
364
    my $values  = [ split qr{\|}, $syspref ];
365
366
    return $values;
367
}
368
353
=head2 enable_syspref_cache
369
=head2 enable_syspref_cache
354
370
355
  C4::Context->enable_syspref_cache();
371
  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 => 31;
21
use Test::More tests => 32;
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