Lines 74-80
my $href_entry1 = {
Link Here
|
74 |
content => $new1, |
74 |
content => $new1, |
75 |
lang => $lang1, |
75 |
lang => $lang1, |
76 |
expirationdate => $expirationdate1, |
76 |
expirationdate => $expirationdate1, |
77 |
timestamp => $timestamp1, |
77 |
publicationdate=> $timestamp1, |
78 |
number => $number1, |
78 |
number => $number1, |
79 |
branchcode => 'LIB1', |
79 |
branchcode => 'LIB1', |
80 |
}; |
80 |
}; |
Lines 89-95
my $href_entry2 = {
Link Here
|
89 |
content => $new2, |
89 |
content => $new2, |
90 |
lang => $lang2, |
90 |
lang => $lang2, |
91 |
expirationdate => $expirationdate2, |
91 |
expirationdate => $expirationdate2, |
92 |
timestamp => $timestamp2, |
92 |
publicationdate=> $timestamp2, |
93 |
number => $number2, |
93 |
number => $number2, |
94 |
borrowernumber => $brwrnmbr, |
94 |
borrowernumber => $brwrnmbr, |
95 |
branchcode => 'LIB1', |
95 |
branchcode => 'LIB1', |
Lines 103-109
my $href_entry3 = {
Link Here
|
103 |
title => $title3, |
103 |
title => $title3, |
104 |
content => $new3, |
104 |
content => $new3, |
105 |
lang => $lang3, |
105 |
lang => $lang3, |
106 |
timestamp => $timestamp3, |
106 |
publicationdate=> $timestamp3, |
107 |
number => $number3, |
107 |
number => $number3, |
108 |
borrowernumber => $brwrnmbr, |
108 |
borrowernumber => $brwrnmbr, |
109 |
branchcode => 'LIB1', |
109 |
branchcode => 'LIB1', |
Lines 114-127
is( $rv, 1, 'Successfully added the third dummy news item without expiration dat
Link Here
|
114 |
# We need to determine the idnew in a non-MySQLism way. |
114 |
# We need to determine the idnew in a non-MySQLism way. |
115 |
# This should be good enough. |
115 |
# This should be good enough. |
116 |
my $query = |
116 |
my $query = |
117 |
q{ SELECT idnew from opac_news WHERE timestamp='2000-01-01' AND expirationdate='2999-12-30'; }; |
117 |
q{ SELECT idnew from opac_news WHERE publicationdate='2000-01-01' AND expirationdate='2999-12-30'; }; |
118 |
my ( $idnew1 ) = $dbh->selectrow_array( $query ); |
118 |
my ( $idnew1 ) = $dbh->selectrow_array( $query ); |
119 |
$query = |
119 |
$query = |
120 |
q{ SELECT idnew from opac_news WHERE timestamp='2000-01-01' AND expirationdate='2999-12-31'; }; |
120 |
q{ SELECT idnew from opac_news WHERE publicationdate='2000-01-01' AND expirationdate='2999-12-31'; }; |
121 |
my ( $idnew2 ) = $dbh->selectrow_array( $query ); |
121 |
my ( $idnew2 ) = $dbh->selectrow_array( $query ); |
122 |
|
122 |
|
123 |
$query = |
123 |
$query = |
124 |
q{ SELECT idnew from opac_news WHERE timestamp='2000-01-02'; }; |
124 |
q{ SELECT idnew from opac_news WHERE publicationdate='2000-01-02'; }; |
125 |
my ( $idnew3 ) = $dbh->selectrow_array( $query ); |
125 |
my ( $idnew3 ) = $dbh->selectrow_array( $query ); |
126 |
|
126 |
|
127 |
# Test upd_opac_new |
127 |
# Test upd_opac_new |
Lines 140-145
$expirationdate1 = output_pref( { dt => dt_from_string( $expirationdate1 ), date
Link Here
|
140 |
$timestamp2 = output_pref( { dt => dt_from_string( $timestamp2 ), dateonly => 1 } ); |
140 |
$timestamp2 = output_pref( { dt => dt_from_string( $timestamp2 ), dateonly => 1 } ); |
141 |
$expirationdate2 = output_pref( { dt => dt_from_string( $expirationdate2) , dateonly => 1 } ); |
141 |
$expirationdate2 = output_pref( { dt => dt_from_string( $expirationdate2) , dateonly => 1 } ); |
142 |
|
142 |
|
|
|
143 |
my $updated_on = %{get_opac_new($idnew1)}{updated_on}; |
143 |
is_deeply( |
144 |
is_deeply( |
144 |
get_opac_new($idnew1), |
145 |
get_opac_new($idnew1), |
145 |
{ |
146 |
{ |
Lines 147-168
is_deeply(
Link Here
|
147 |
content => $new1, |
148 |
content => $new1, |
148 |
lang => $lang1, |
149 |
lang => $lang1, |
149 |
expirationdate => $expirationdate1, |
150 |
expirationdate => $expirationdate1, |
150 |
timestamp => $timestamp1, |
151 |
publicationdate=> $timestamp1, |
151 |
number => $number1, |
152 |
number => $number1, |
152 |
borrowernumber => undef, |
153 |
borrowernumber => undef, |
153 |
idnew => $idnew1, |
154 |
idnew => $idnew1, |
154 |
branchname => "$addbra branch", |
155 |
branchname => "$addbra branch", |
155 |
branchcode => $addbra, |
156 |
branchcode => $addbra, |
156 |
# this represents $lang => 1 in the hash |
157 |
updated_on => $updated_on, |
157 |
# that's returned... which seems a little |
|
|
158 |
# redundant given that there's a perfectly |
159 |
# good 'lang' key in the hash |
160 |
'' => 1, |
161 |
}, |
158 |
}, |
162 |
'got back expected news item via get_opac_new - ID 1' |
159 |
'got back expected news item via get_opac_new - ID 1' |
163 |
); |
160 |
); |
164 |
|
161 |
|
165 |
# Test get_opac_new (single news item) |
162 |
# Test get_opac_new (single news item) |
|
|
163 |
$updated_on = %{get_opac_new($idnew2)}{updated_on}; |
166 |
is_deeply( |
164 |
is_deeply( |
167 |
get_opac_new($idnew2), |
165 |
get_opac_new($idnew2), |
168 |
{ |
166 |
{ |
Lines 170-182
is_deeply(
Link Here
|
170 |
content => $new2, |
168 |
content => $new2, |
171 |
lang => $lang2, |
169 |
lang => $lang2, |
172 |
expirationdate => $expirationdate2, |
170 |
expirationdate => $expirationdate2, |
173 |
timestamp => $timestamp2, |
171 |
publicationdate=> $timestamp2, |
174 |
number => $number2, |
172 |
number => $number2, |
175 |
borrowernumber => $brwrnmbr, |
173 |
borrowernumber => $brwrnmbr, |
176 |
idnew => $idnew2, |
174 |
idnew => $idnew2, |
177 |
branchname => "$addbra branch", |
175 |
branchname => "$addbra branch", |
178 |
branchcode => $addbra, |
176 |
branchcode => $addbra, |
179 |
'' => 1, |
177 |
updated_on => $updated_on, |
180 |
}, |
178 |
}, |
181 |
'got back expected news item via get_opac_new - ID 2' |
179 |
'got back expected news item via get_opac_new - ID 2' |
182 |
); |
180 |
); |
183 |
- |
|
|