3 # This file is part of Koha.
5 # Koha is free software; you can redistribute it and/or modify it under the
6 # terms of the GNU General Public License as published by the Free Software
7 # Foundation; either version 2 of the License, or (at your option) any later
10 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
11 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License along
15 # with Koha; if not, write to the Free Software Foundation, Inc.,
16 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 use File
::Basename qw
/basename/;
24 use t
::lib
::TestBuilder
;
26 use Test
::More tests
=> 3;
28 my $schema = Koha
::Database
->new->schema;
29 use_ok
('Koha::Illrequestattribute');
30 use_ok
('Koha::Illrequestattributes');
32 subtest
'Basic object tests' => sub {
36 $schema->storage->txn_begin;
38 my $builder = t
::lib
::TestBuilder
->new;
40 my $illrqattr = $builder->build({ source
=> 'Illrequestattribute' });
42 my $illrqattr_obj = Koha
::Illrequestattributes
->find(
43 $illrqattr->{illrequest_id
},
46 isa_ok
($illrqattr_obj, 'Koha::Illrequestattribute',
47 "Correctly create and load an illrequestattribute object.");
48 is
($illrqattr_obj->illrequest_id, $illrqattr->{illrequest_id
},
49 "Illrequest_id getter works.");
50 is
($illrqattr_obj->type, $illrqattr->{type
},
51 "Type getter works.");
52 is
($illrqattr_obj->value, $illrqattr->{value
},
53 "Value getter works.");
55 $illrqattr_obj->delete;
57 is
(Koha
::Illrequestattributes
->search->count, 0,
58 "No attributes found after delete.");
60 $schema->storage->txn_rollback;