Bugzilla – Attachment 109196 Details for
Bug 21066
Replace opac_news.timestamp by published_on and add updated_on as timestamp
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 21066: Update NewsChannels.t
Bug-21066-Update-NewsChannelst.patch (text/plain), 5.14 KB, created by
Katrin Fischer
on 2020-08-26 19:21:49 UTC
(
hide
)
Description:
Bug 21066: Update NewsChannels.t
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2020-08-26 19:21:49 UTC
Size:
5.14 KB
patch
obsolete
>From 172b9a7cca92686e533895b40f8d7eb4161af85e Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Mon, 3 Aug 2020 14:27:24 +0000 >Subject: [PATCH] Bug 21066: Update NewsChannels.t > >Removing the weird '' => 1 from the hash too. >NOTE: The following line in the module seems to be useless: > $data->{$data->{'lang'}} = 1 if defined $data->{lang}; > >Test plan: >Run t/db_dependent/NewsChannels.t >Run t/db_dependent/Koha/News.t > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> > >Signed-off-by: Owen Leonard <oleonard@myacpl.org> > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > C4/NewsChannels.pm | 1 - > t/db_dependent/NewsChannels.t | 26 ++++++++++++-------------- > 2 files changed, 12 insertions(+), 15 deletions(-) > >diff --git a/C4/NewsChannels.pm b/C4/NewsChannels.pm >index f39113cd89..e9733901a5 100644 >--- a/C4/NewsChannels.pm >+++ b/C4/NewsChannels.pm >@@ -135,7 +135,6 @@ sub get_opac_new { > my $sth = $dbh->prepare($query); > $sth->execute($idnew); > my $data = $sth->fetchrow_hashref; >- $data->{$data->{'lang'}} = 1 if defined $data->{lang}; > $data->{expirationdate} = output_pref({ dt => dt_from_string( $data->{expirationdate} ), dateonly => 1 }) if ( $data->{expirationdate} ); > $data->{publicationdate} = output_pref({ dt => dt_from_string( $data->{publicationdate} ), dateonly => 1 }); > return $data; >diff --git a/t/db_dependent/NewsChannels.t b/t/db_dependent/NewsChannels.t >index 928ddd5cd5..f6cf6bcee0 100644 >--- a/t/db_dependent/NewsChannels.t >+++ b/t/db_dependent/NewsChannels.t >@@ -74,7 +74,7 @@ my $href_entry1 = { > content => $new1, > lang => $lang1, > expirationdate => $expirationdate1, >- timestamp => $timestamp1, >+ publicationdate=> $timestamp1, > number => $number1, > branchcode => 'LIB1', > }; >@@ -89,7 +89,7 @@ my $href_entry2 = { > content => $new2, > lang => $lang2, > expirationdate => $expirationdate2, >- timestamp => $timestamp2, >+ publicationdate=> $timestamp2, > number => $number2, > borrowernumber => $brwrnmbr, > branchcode => 'LIB1', >@@ -103,7 +103,7 @@ my $href_entry3 = { > title => $title3, > content => $new3, > lang => $lang3, >- timestamp => $timestamp3, >+ publicationdate=> $timestamp3, > number => $number3, > borrowernumber => $brwrnmbr, > branchcode => 'LIB1', >@@ -114,14 +114,14 @@ is( $rv, 1, 'Successfully added the third dummy news item without expiration dat > # We need to determine the idnew in a non-MySQLism way. > # This should be good enough. > my $query = >-q{ SELECT idnew from opac_news WHERE timestamp='2000-01-01' AND expirationdate='2999-12-30'; }; >+q{ SELECT idnew from opac_news WHERE publicationdate='2000-01-01' AND expirationdate='2999-12-30'; }; > my ( $idnew1 ) = $dbh->selectrow_array( $query ); > $query = >-q{ SELECT idnew from opac_news WHERE timestamp='2000-01-01' AND expirationdate='2999-12-31'; }; >+q{ SELECT idnew from opac_news WHERE publicationdate='2000-01-01' AND expirationdate='2999-12-31'; }; > my ( $idnew2 ) = $dbh->selectrow_array( $query ); > > $query = >-q{ SELECT idnew from opac_news WHERE timestamp='2000-01-02'; }; >+q{ SELECT idnew from opac_news WHERE publicationdate='2000-01-02'; }; > my ( $idnew3 ) = $dbh->selectrow_array( $query ); > > # Test upd_opac_new >@@ -140,6 +140,7 @@ $expirationdate1 = output_pref( { dt => dt_from_string( $expirationdate1 ), date > $timestamp2 = output_pref( { dt => dt_from_string( $timestamp2 ), dateonly => 1 } ); > $expirationdate2 = output_pref( { dt => dt_from_string( $expirationdate2) , dateonly => 1 } ); > >+my $updated_on = %{get_opac_new($idnew1)}{updated_on}; > is_deeply( > get_opac_new($idnew1), > { >@@ -147,22 +148,19 @@ is_deeply( > content => $new1, > lang => $lang1, > expirationdate => $expirationdate1, >- timestamp => $timestamp1, >+ publicationdate=> $timestamp1, > number => $number1, > borrowernumber => undef, > idnew => $idnew1, > branchname => "$addbra branch", > branchcode => $addbra, >- # this represents $lang => 1 in the hash >- # that's returned... which seems a little >- # redundant given that there's a perfectly >- # good 'lang' key in the hash >- '' => 1, >+ updated_on => $updated_on, > }, > 'got back expected news item via get_opac_new - ID 1' > ); > > # Test get_opac_new (single news item) >+$updated_on = %{get_opac_new($idnew2)}{updated_on}; > is_deeply( > get_opac_new($idnew2), > { >@@ -170,13 +168,13 @@ is_deeply( > content => $new2, > lang => $lang2, > expirationdate => $expirationdate2, >- timestamp => $timestamp2, >+ publicationdate=> $timestamp2, > number => $number2, > borrowernumber => $brwrnmbr, > idnew => $idnew2, > branchname => "$addbra branch", > branchcode => $addbra, >- '' => 1, >+ updated_on => $updated_on, > }, > 'got back expected news item via get_opac_new - ID 2' > ); >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 21066
:
77037
|
77038
|
77039
|
107769
|
107770
|
107771
|
107772
|
107773
|
107774
|
107775
|
107776
|
109148
|
109149
|
109150
|
109151
|
109152
|
109153
|
109154
|
109192
|
109193
|
109194
|
109195
| 109196 |
109197
|
109198
|
109199
|
109354
|
109514
|
109515