Bug 11543: Increasing test coverage for Category.pm
To test: 1. Run prove t/Category.t 2. Apply patch 3. Run prove t/db_dependent/Category.t - Notice 2 tests were run Signed-off-by: daniel <daniel.barker.nz@gmail.com> Made the requested changes. 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
42ec10670e
commit
546c6861f9
2 changed files with 24 additions and 14 deletions
14
t/Category.t
14
t/Category.t
|
@ -1,14 +0,0 @@
|
|||
#!/usr/bin/perl
|
||||
#
|
||||
# This Koha test module is a stub!
|
||||
# Add more tests here!!!
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use Test::More tests => 1;
|
||||
|
||||
BEGIN {
|
||||
use_ok('C4::Category');
|
||||
}
|
||||
|
24
t/db_dependent/Category.t
Executable file
24
t/db_dependent/Category.t
Executable file
|
@ -0,0 +1,24 @@
|
|||
#!/usr/bin/perl
|
||||
#
|
||||
# This Koha test module is a stub!
|
||||
# Add more tests here!!!
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use Test::More tests => 2;
|
||||
|
||||
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);
|
||||
|
||||
$dbh->rollback;
|
Loading…
Reference in a new issue