Bugzilla – Attachment 108097 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: Remove GetDailyQuote tests from Koha.t
0001-Bug-16371-Remove-GetDailyQuote-tests-from-Koha.t.patch (text/plain), 4.01 KB, created by
Emmi Takkinen
on 2020-08-12 11:45:11 UTC
(
hide
)
Description:
Bug 16371: Remove GetDailyQuote tests from Koha.t
Filename:
MIME Type:
Creator:
Emmi Takkinen
Created:
2020-08-12 11:45:11 UTC
Size:
4.01 KB
patch
obsolete
>From fa1ac76dc0f45911e459c6c8138e05c32bf32231 Mon Sep 17 00:00:00 2001 >From: Emmi Takkinen <emmi.takkinen@outlook.com> >Date: Wed, 12 Aug 2020 09:16:43 +0300 >Subject: [PATCH 1/2] Bug 16371: Remove GetDailyQuote tests from Koha.t > >Tests in Koha.t failed due GetDailyQuote tests. This patch >removes these tests since we test quotes in Quotes.t instead. > >To test prove t/db_dependent/Koha.t > >Sponsored-by: Koha-Suomi Oy >--- > t/db_dependent/Koha.t | 63 ++----------------------------------------- > 1 file changed, 2 insertions(+), 61 deletions(-) > >diff --git a/t/db_dependent/Koha.t b/t/db_dependent/Koha.t >index e21687830f..9e0b8d3af9 100644 >--- a/t/db_dependent/Koha.t >+++ b/t/db_dependent/Koha.t >@@ -4,19 +4,17 @@ > # It requires a working Koha database with the sample data > > use Modern::Perl; >-use DateTime::Format::MySQL; >-use Test::More tests => 6; >+use Test::More tests => 5; > > use t::lib::TestBuilder; > > use C4::Context; > use Koha::Database; >-use Koha::DateUtils qw(dt_from_string); > use Koha::AuthorisedValue; > use Koha::AuthorisedValueCategories; > > BEGIN { >- use_ok('C4::Koha', qw( :DEFAULT GetDailyQuote GetItemTypesCategorized)); >+ use_ok('C4::Koha', qw( :DEFAULT GetItemTypesCategorized)); > use_ok('C4::Members'); > } > >@@ -157,63 +155,6 @@ subtest 'Authorized Values Tests' => sub { > > }; > >-### test for C4::Koha->GetDailyQuote() >-SKIP: >- { >- eval { require Test::Deep; import Test::Deep; }; >- skip "Test::Deep required to run the GetDailyQuote tests.", 1 if $@; >- >- subtest 'Daily Quotes Test' => sub { >- plan tests => 4; >- >- SKIP: { >- >- skip "C4::Koha can't \'GetDailyQuote\'!", 3 unless can_ok('C4::Koha','GetDailyQuote'); >- >-# Fill the quote table with the default needed and a spare >-$dbh->do("DELETE FROM quotes WHERE id=3 OR id=25;"); >-my $sql = "INSERT INTO quotes (id,source,text,timestamp) VALUES >-(25,'Richard Nixon','When the President does it, that means that it is not illegal.',NOW()), >-(3,'Abraham Lincoln','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.',NOW());"; >-$dbh->do($sql); >- >- my $expected_quote = { >- id => 3, >- 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 => re('\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}'), #'YYYY-MM-DD HH:MM:SS' >- }; >- >-# test quote retrieval based on id >- >- my $quote = GetDailyQuote('id'=>3); >- cmp_deeply ($quote, $expected_quote, "Got a quote based on id.") or >- diag('Be sure to run this test on a clean install of sample data.'); >- >-# test quote retrieval based on today's date >- >- my $query = 'UPDATE quotes SET timestamp = ? WHERE id = ?'; >- my $sth = C4::Context->dbh->prepare($query); >- $sth->execute(DateTime::Format::MySQL->format_datetime( dt_from_string() ), $expected_quote->{'id'}); >- >- DateTime::Format::MySQL->format_datetime( dt_from_string() ) =~ m/(\d{4}-\d{2}-\d{2})/; >- $expected_quote->{'timestamp'} = re("^$1"); >- >-# $expected_quote->{'timestamp'} = DateTime::Format::MySQL->format_datetime( dt_from_string() ); # update the timestamp of expected quote data >- >- $quote = GetDailyQuote(); # this is the "default" mode of selection >- cmp_deeply ($quote, $expected_quote, "Got a quote based on today's date.") or >- diag('Be sure to run this test on a clean install of sample data.'); >- >-# test random quote retrieval >- >- $quote = GetDailyQuote('random'=>1); >- ok ($quote, "Got a random quote."); >- } >- }; >-} >- >- > subtest 'ISBN tests' => sub { > plan tests => 6; > >-- >2.17.1 >
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