Lines 5-11
use Koha::Database;
Link Here
|
5 |
use Koha::DateUtils; |
5 |
use Koha::DateUtils; |
6 |
use Koha::Libraries; |
6 |
use Koha::Libraries; |
7 |
|
7 |
|
8 |
use Test::More tests => 14; |
8 |
use Test::More tests => 11; |
9 |
|
9 |
|
10 |
BEGIN { |
10 |
BEGIN { |
11 |
use_ok('C4::NewsChannels'); |
11 |
use_ok('C4::NewsChannels'); |
Lines 134-188
$href_entry2->{idnew} = $idnew2;
Link Here
|
134 |
$rv = upd_opac_new($href_entry2); |
134 |
$rv = upd_opac_new($href_entry2); |
135 |
is( $rv, 1, 'Successfully updated second dummy news item!' ); |
135 |
is( $rv, 1, 'Successfully updated second dummy news item!' ); |
136 |
|
136 |
|
137 |
# Test get_opac_new (single news item) |
|
|
138 |
$timestamp1 = output_pref( { dt => dt_from_string( $timestamp1 ), dateonly => 1 } ); |
139 |
$expirationdate1 = output_pref( { dt => dt_from_string( $expirationdate1 ), dateonly => 1 } ); |
140 |
$timestamp2 = output_pref( { dt => dt_from_string( $timestamp2 ), dateonly => 1 } ); |
141 |
$expirationdate2 = output_pref( { dt => dt_from_string( $expirationdate2) , dateonly => 1 } ); |
142 |
|
143 |
my $updated_on = %{get_opac_new($idnew1)}{updated_on}; |
144 |
is_deeply( |
145 |
get_opac_new($idnew1), |
146 |
{ |
147 |
title => $title1, |
148 |
content => $new1, |
149 |
lang => $lang1, |
150 |
expirationdate => $expirationdate1, |
151 |
published_on=> $timestamp1, |
152 |
number => $number1, |
153 |
borrowernumber => undef, |
154 |
idnew => $idnew1, |
155 |
branchname => "$addbra branch", |
156 |
branchcode => $addbra, |
157 |
updated_on => $updated_on, |
158 |
}, |
159 |
'got back expected news item via get_opac_new - ID 1' |
160 |
); |
161 |
|
162 |
# Test get_opac_new (single news item) |
163 |
$updated_on = %{get_opac_new($idnew2)}{updated_on}; |
164 |
is_deeply( |
165 |
get_opac_new($idnew2), |
166 |
{ |
167 |
title => $title2, |
168 |
content => $new2, |
169 |
lang => $lang2, |
170 |
expirationdate => $expirationdate2, |
171 |
published_on=> $timestamp2, |
172 |
number => $number2, |
173 |
borrowernumber => $brwrnmbr, |
174 |
idnew => $idnew2, |
175 |
branchname => "$addbra branch", |
176 |
branchcode => $addbra, |
177 |
updated_on => $updated_on, |
178 |
}, |
179 |
'got back expected news item via get_opac_new - ID 2' |
180 |
); |
181 |
|
182 |
# Test get_opac_new (single news item without expiration date) |
183 |
my $news3 = get_opac_new($idnew3); |
184 |
is($news3->{ expirationdate }, undef, "Expiration date should be empty"); |
185 |
|
186 |
# Test get_opac_news (multiple news items) |
137 |
# Test get_opac_news (multiple news items) |
187 |
my ( $opac_news_count, $arrayref_opac_news ) = get_opac_news( 0, q{}, 'LIB1' ); |
138 |
my ( $opac_news_count, $arrayref_opac_news ) = get_opac_news( 0, q{}, 'LIB1' ); |
188 |
|
139 |
|