Bug 11543: (followup) add one more test
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com> Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de> Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This commit is contained in:
parent
546c6861f9
commit
c37a8ad151
1 changed files with 16 additions and 10 deletions
|
@ -3,22 +3,28 @@
|
|||
# This Koha test module is a stub!
|
||||
# Add more tests here!!!
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Modern::Perl;
|
||||
|
||||
use Test::More tests => 2;
|
||||
use Test::More tests => 3;
|
||||
|
||||
use_ok('C4::Category');
|
||||
|
||||
BEGIN {
|
||||
use_ok('C4::Category');
|
||||
}
|
||||
use C4::Context;
|
||||
my $dbh = C4::Context->dbh;
|
||||
$dbh->{RaiseError} = 1;
|
||||
$dbh->{AutoCommit} = 0;
|
||||
|
||||
my $sth=$dbh->prepare("INSERT INTO categories (categorycode,description,enrolmentperiod,enrolmentperioddate,upperagelimit,dateofbirthrequired,
|
||||
enrolmentfee,reservefee,hidelostitems,overduenoticerequired,category_type) values (?,?,?,?,?,?,?,?,?,?,?)");
|
||||
$sth->execute("test", "Desc", 12, "2014-01-02", 99, 1, 1.5, 2.5, 0, 0, "A") || die $sth->errstr;
|
||||
ok( my @categories = C4::Category->all);
|
||||
my $sth=$dbh->prepare('
|
||||
INSERT INTO categories( categorycode, description, enrolmentperiod, enrolmentperioddate, upperagelimit, dateofbirthrequired, enrolmentfee, reservefee, hidelostitems, overduenoticerequired, category_type )
|
||||
VALUES (?,?,?,?,?,?,?,?,?,?,?)
|
||||
');
|
||||
|
||||
my $nonexistent_categorycode = 'NONEXISTEN';
|
||||
$sth->execute($nonexistent_categorycode, "Desc", 12, "2014-01-02", 99, 1, 1.5, 2.5, 0, 0, "A") || die $sth->errstr;
|
||||
my @categories = C4::Category->all;
|
||||
ok( @categories, 'all returns categories' );
|
||||
|
||||
my $match = grep {$_->{categorycode} eq $nonexistent_categorycode } @categories;
|
||||
is( $match, 1, 'all returns the inserted category');
|
||||
|
||||
$dbh->rollback;
|
||||
|
|
Loading…
Reference in a new issue