3 # This Koha test module is a stub!
4 # Add more tests here!!!
8 use Test
::More tests
=> 3;
10 use_ok
('C4::Category');
13 my $dbh = C4
::Context
->dbh;
14 $dbh->{RaiseError
} = 1;
15 $dbh->{AutoCommit
} = 0;
17 my $sth=$dbh->prepare('
18 INSERT INTO categories( categorycode, description, enrolmentperiod, enrolmentperioddate, upperagelimit, dateofbirthrequired, enrolmentfee, reservefee, hidelostitems, overduenoticerequired, category_type )
19 VALUES (?,?,?,?,?,?,?,?,?,?,?)
22 my $nonexistent_categorycode = 'NONEXISTEN';
23 $sth->execute($nonexistent_categorycode, "Desc", 12, "2014-01-02", 99, 1, 1.5, 2.5, 0, 0, "A") || die $sth->errstr;
24 my @categories = C4
::Category
->all;
25 ok
( @categories, 'all returns categories' );
27 my $match = grep {$_->{categorycode
} eq $nonexistent_categorycode } @categories;
28 is
( $match, 1, 'all returns the inserted category');