From 546c6861f94888a9631a5332cf6c6f0c1301e063 Mon Sep 17 00:00:00 2001 From: Roman Amor Date: Tue, 14 Jan 2014 14:17:06 +1300 Subject: [PATCH] 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 Made the requested changes. Signed-off-by: Jonathan Druart Signed-off-by: Katrin Fischer Signed-off-by: Galen Charlton --- t/Category.t | 14 -------------- t/db_dependent/Category.t | 24 ++++++++++++++++++++++++ 2 files changed, 24 insertions(+), 14 deletions(-) delete mode 100755 t/Category.t create mode 100755 t/db_dependent/Category.t diff --git a/t/Category.t b/t/Category.t deleted file mode 100755 index 6c251ea472..0000000000 --- a/t/Category.t +++ /dev/null @@ -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'); -} - diff --git a/t/db_dependent/Category.t b/t/db_dependent/Category.t new file mode 100755 index 0000000000..056dd3751e --- /dev/null +++ b/t/db_dependent/Category.t @@ -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; -- 2.39.5