Bugzilla – Attachment 103979 Details for
Bug 16371
Quote of the Day (QOTD) for the staff interface
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 16371: Fix tests
Bug-16371-Fix-tests.patch (text/plain), 5.19 KB, created by
David Nind
on 2020-04-29 18:04:26 UTC
(
hide
)
Description:
Bug 16371: Fix tests
Filename:
MIME Type:
Creator:
David Nind
Created:
2020-04-29 18:04:26 UTC
Size:
5.19 KB
patch
obsolete
>From 4c0edf375ca3ce9d94806e94c7843e519e6e3c2d Mon Sep 17 00:00:00 2001 >From: Emmi Takkinen <emmi.takkinen@outlook.com> >Date: Mon, 27 Apr 2020 08:55:38 +0300 >Subject: [PATCH] Bug 16371: Fix tests > >Tests failed due ids already existing in 'quotes' table. >This patch removes hardcoded ids from tests. > >Sponsored-by: Koha-Suomi Oy > >Signed-off-by: David Nind <david@davidnind.com> >--- > t/db_dependent/Koha/Quotes.t | 22 +++++++++++----------- > 1 file changed, 11 insertions(+), 11 deletions(-) > >diff --git a/t/db_dependent/Koha/Quotes.t b/t/db_dependent/Koha/Quotes.t >index de8212a9dd..c935569801 100644 >--- a/t/db_dependent/Koha/Quotes.t >+++ b/t/db_dependent/Koha/Quotes.t >@@ -39,15 +39,15 @@ $schema->storage->txn_begin; > my $dbh = C4::Context->dbh; > > # Ids not starting with 1 to reflect possible deletes, this acts as a regression test for bug 11297 >-my $timestamp = DateTime::Format::MySQL->format_datetime(dt_from_string()); #??? >-my $quote_1 = Koha::Quote->new({ id => 6, source => 'George Washington', text => 'To be prepared for war is one of the most effectual means of preserving peace.', timestamp => $timestamp })->store; >-my $quote_2 = Koha::Quote->new({ id => 7, source => 'Thomas Jefferson', text => 'When angry, count ten, before you speak; if very angry, an hundred.', timestamp => $timestamp })->store; >-my $quote_3 = Koha::Quote->new({ id => 8, source => 'Abraham Lincoln', text => 'Four score and seven years ago our fathers brought forth on this continent, a new nation, conceived in Liberty, and dedicated to the proposition that all men are created equal', timestamp => $timestamp })->store; >-my $quote_4 = Koha::Quote->new({ id => 9, source => 'Abraham Lincoln', text => 'I have always found that mercy bears richer fruits than strict justice.', timestamp => $timestamp })->store; >-my $quote_5 = Koha::Quote->new({ id => 10, source => 'Andrew Johnson', text => 'I feel incompetent to perform duties...which have been so unexpectedly thrown upon me.', timestamp => $timestamp })->store; >+my $timestamp = DateTime::Format::MySQL->format_datetime(dt_from_string()); >+my $quote_1 = Koha::Quote->new({ source => 'George Washington', text => 'To be prepared for war is one of the most effectual means of preserving peace.', timestamp => $timestamp })->store; >+my $quote_2 = Koha::Quote->new({ source => 'Thomas Jefferson', text => 'When angry, count ten, before you speak; if very angry, an hundred.', timestamp => $timestamp })->store; >+my $quote_3 = Koha::Quote->new({ source => 'Abraham Lincoln', text => 'Four score and seven years ago our fathers brought forth on this continent, a new nation, conceived in Liberty, and dedicated to the proposition that all men are created equal', timestamp => $timestamp })->store; >+my $quote_4 = Koha::Quote->new({ source => 'Abraham Lincoln', text => 'I have always found that mercy bears richer fruits than strict justice.', timestamp => $timestamp })->store; >+my $quote_5 = Koha::Quote->new({ source => 'Andrew Johnson', text => 'I feel incompetent to perform duties...which have been so unexpectedly thrown upon me.', timestamp => $timestamp })->store; > > my $expected_quote = { >- id => 8, >+ id => $quote_3->id, > source => 'Abraham Lincoln', > text => 'Four score and seven years ago our fathers brought forth on this continent, a new nation, conceived in Liberty, and dedicated to the proposition that all men are created equal.', > timestamp => dt_from_string, >@@ -75,10 +75,10 @@ $quote = eval {Koha::Quote->get_daily_quote();}; > is( $@, '', 'get_daily_quote does not die if no quote exist' ); > is_deeply( $quote, {}, 'get_daily_quote return an empty hashref is no quote exist'); # Is it what we expect? > >-my $quote_6 = Koha::Quote->new({ id => 6, source => 'George Washington', text => 'To be prepared for war is one of the most effectual means of preserving peace.', timestamp => dt_from_string() })->store; >+my $quote_6 = Koha::Quote->new({ source => 'George Washington', text => 'To be prepared for war is one of the most effectual means of preserving peace.', timestamp => dt_from_string() })->store; > > $quote = Koha::Quote->get_daily_quote(); >-is( $quote->{id}, 6, ' get_daily_quote returns the only existing quote' ); >+is( $quote->{id}, $quote_6->id, ' get_daily_quote returns the only existing quote' ); > > $schema->storage->txn_rollback; > >@@ -89,10 +89,10 @@ subtest "get_daily_quote_for_interface" => sub { > $schema->storage->txn_begin; > > my ($quote); >- my $quote_1 = Koha::Quote->new({ id => 10, source => 'Dusk And Her Embrace', text => 'Unfurl thy limbs breathless succubus<br/>How the full embosomed fog<br/>Imparts the night to us....', timestamp => dt_from_string })->store; >+ my $quote_1 = Koha::Quote->new({ source => 'Dusk And Her Embrace', text => 'Unfurl thy limbs breathless succubus<br/>How the full embosomed fog<br/>Imparts the night to us....', timestamp => dt_from_string })->store; > > my $expected_quote = { >- id => 10, >+ id => $quote_1->id, > source => 'Dusk And Her Embrace', > text => 'Unfurl thy limbs breathless succubus<br/>How the full embosomed fog<br/>Imparts the night to us....', > timestamp => DateTime::Format::MySQL->format_datetime(dt_from_string), >-- >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 16371
:
102515
|
102516
|
102517
|
102969
|
103019
|
103329
|
103330
|
103331
|
103332
|
103333
|
103334
|
103732
|
103973
|
103974
|
103975
|
103976
|
103977
|
103978
|
103979
|
106818
|
106819
|
106820
|
106858
|
106859
|
106860
|
106861
|
106862
|
106863
|
106864
|
106865
|
106866
|
106867
|
106868
|
106894
|
106895
|
106896
|
106897
|
106898
|
106899
|
106900
|
106901
|
106902
|
106903
|
108097
|
108098
|
108160
|
108163