From 59ddf8f2cec406a505b0260d2a686ba915b615c8 Mon Sep 17 00:00:00 2001
From: Tomas Cohen Arazi <tomascohen@theke.io>
Date: Fri, 9 Jun 2017 11:16:08 -0300
Subject: [PATCH] Bug 18767: Remove useless diags from GetDailyQuote.t
This tests print useless debugging info.
To test:
- Run:
$ sudo koha-shell kohadev
k$ cd kohaclone
k$ prove t/db_dependent/Koha/GetDailyQuote.t
=> FAIL: Some output telling what is doing on each step is printed.
- Apply the patch
- Run
k$ prove t/db_dependent/Koha/GetDailyQuote.t
=> SUCCESS: No output, YAY!
- Sign off :-D
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
---
t/db_dependent/Koha/GetDailyQuote.t | 26 ++++++++++++++++++++------
1 file changed, 20 insertions(+), 6 deletions(-)
diff --git a/t/db_dependent/Koha/GetDailyQuote.t b/t/db_dependent/Koha/GetDailyQuote.t
index d003218c17..f6cc6cd6d6 100644
--- a/t/db_dependent/Koha/GetDailyQuote.t
+++ b/t/db_dependent/Koha/GetDailyQuote.t
@@ -1,8 +1,24 @@
#!/usr/bin/perl
+# This file is part of Koha.
+#
+# Koha is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# Koha is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Koha; if not, see <http://www.gnu.org/licenses>.
+
use Modern::Perl;
use Test::More tests => 12;
+
use C4::Koha qw( GetDailyQuote );
use DateTime::Format::MySQL;
use Koha::DateUtils qw(dt_from_string);
@@ -37,19 +53,14 @@ my $expected_quote = {
timestamp => '0000-00-00 00:00:00',
};
-diag("Get a quote based on id");
my $quote = GetDailyQuote('id'=>8);
-cmp_ok($quote->{'id'}, '==', $expected_quote->{'id'}, "Id is correct");
+cmp_ok($quote->{'id'}, '==', $expected_quote->{'id'}, "Correctly got quote by ID");
is($quote->{'quote'}, $expected_quote->{'quote'}, "Quote is correct");
-
-diag("Get a random quote");
$quote = GetDailyQuote('random'=>1);
ok($quote, "Got a random quote.");
cmp_ok($quote->{'id'}, '>', 0, 'Id is greater than 0');
-
-diag("Get a quote based on today's date");
$dbh->do("UPDATE quotes SET timestamp = '0000-00-00 00:00:00';");
my $timestamp = DateTime::Format::MySQL->format_datetime(dt_from_string());
my $query = 'UPDATE quotes SET timestamp = ? WHERE id = ?';
@@ -75,3 +86,6 @@ $quote = GetDailyQuote();
is( $quote->{id}, 6, ' GetDailyQuote returns the only existing quote' );
$dbh->rollback;
+
+1;
+
--
2.13.1