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>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 78a9f39f9a)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
Tomas Cohen Arazi 2017-06-09 11:16:08 -03:00 committed by Fridolin Somers
parent c5fcadf128
commit 4def0870d8
1 changed files with 17 additions and 6 deletions

View File

@ -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 = ?';