Lines 33-39
my $builder = t::lib::TestBuilder->new;
Link Here
|
33 |
$schema->storage->txn_begin; |
33 |
$schema->storage->txn_begin; |
34 |
|
34 |
|
35 |
subtest 'get' => sub { |
35 |
subtest 'get' => sub { |
36 |
plan tests => 4; |
36 |
plan tests => 6; |
37 |
|
37 |
|
38 |
my $additional_contents = Koha::Template::Plugin::AdditionalContents->get( |
38 |
my $additional_contents = Koha::Template::Plugin::AdditionalContents->get( |
39 |
{ category => 'news', location => [ 'opac_only', 'staff_and_opac' ], lang => 'default', library => '%' } ); |
39 |
{ category => 'news', location => [ 'opac_only', 'staff_and_opac' ], lang => 'default', library => '%' } ); |
Lines 61-66
subtest 'get' => sub {
Link Here
|
61 |
{ category => 'news', location => [ 'opac_only', 'staff_and_opac' ], lang => 'default' } ); |
61 |
{ category => 'news', location => [ 'opac_only', 'staff_and_opac' ], lang => 'default' } ); |
62 |
is( $additional_contents->{content}->count, $before_count + 1, "We get the additional one we added" ); |
62 |
is( $additional_contents->{content}->count, $before_count + 1, "We get the additional one we added" ); |
63 |
|
63 |
|
|
|
64 |
my $expired_additional_content = $builder->build_object( |
65 |
{ |
66 |
class => 'Koha::AdditionalContents', |
67 |
value => { |
68 |
category => 'news', |
69 |
location => 'opac_only', |
70 |
branchcode => undef, |
71 |
expirationdate => '0001-01-01', |
72 |
} |
73 |
} |
74 |
); |
75 |
$builder->build_object( |
76 |
{ |
77 |
class => 'Koha::AdditionalContentsLocalizations', |
78 |
value => { |
79 |
additional_content_id => $expired_additional_content->id, |
80 |
lang => 'default', |
81 |
} |
82 |
} |
83 |
); |
84 |
$additional_contents = Koha::Template::Plugin::AdditionalContents->get( |
85 |
{ category => 'news', location => [ 'opac_only', 'staff_and_opac' ], lang => 'default' } ); |
86 |
|
87 |
is( $additional_contents->{content}->count, $before_count + 1, "We do not get the expired content" ); |
88 |
|
89 |
$additional_contents = Koha::Template::Plugin::AdditionalContents->get( |
90 |
{ category => 'news', location => [ 'opac_only', 'staff_and_opac' ], id => $expired_additional_content->id } ); |
91 |
is( $additional_contents->{content}->count, 1, "We still get expired news through direct link" ); |
92 |
|
64 |
$additional_contents = Koha::Template::Plugin::AdditionalContents->get( |
93 |
$additional_contents = Koha::Template::Plugin::AdditionalContents->get( |
65 |
{ |
94 |
{ |
66 |
category => 'news', location => [ 'opac_only', 'staff_and_opac' ], lang => 'default', |
95 |
category => 'news', location => [ 'opac_only', 'staff_and_opac' ], lang => 'default', |
67 |
- |
|
|