Bug 23624: Unit tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Tomas Cohen Arazi 2019-09-19 10:50:46 -03:00 committed by Martin Renvoize
parent 79e15278f7
commit 7958e7f3f9
No known key found for this signature in database
GPG Key ID: 422B469130441A0F
1 changed files with 24 additions and 1 deletions

View File

@ -18,12 +18,13 @@
use Modern::Perl;
use Test::More tests => 10;
use Test::More tests => 11;
use Test::Warn;
use t::lib::TestBuilder;
use C4::Context;
use Koha::Database;
use Koha::Items;
use Koha::Reports;
use Koha::Notice::Messages;
@ -410,6 +411,28 @@ subtest 'Email report test' => sub {
$schema->storage->txn_rollback;
subtest 'nb_rows() tests' => sub {
plan tests => 1;
$schema->storage->txn_begin;
my $items_count = Koha::Items->search->count;
$builder->build_object({ class => 'Koha::Items' });
$builder->build_object({ class => 'Koha::Items' });
$items_count += 2;
my $query = q{
SELECT * FROM items xxx
};
my $nb_rows = nb_rows( $query );
is( $nb_rows, $items_count, 'nb_rows returns the right value' );
$schema->storage->txn_rollback;
};
sub trim {
my ($s) = @_;
$s =~ s/^\s*(.*?)\s*$/$1/s;