Bug 19532: (follow-up) aria-hidden attr on OPAC, and more
[koha.git] / t / db_dependent / Illrequestattributes.t
1 #!/usr/bin/perl
2
3 # This file is part of Koha.
4 #
5 # Koha is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 3 of the License, or
8 # (at your option) any later version.
9 #
10 # Koha is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with Koha; if not, see <http://www.gnu.org/licenses>.
17
18 use Modern::Perl;
19
20 use File::Basename qw/basename/;
21 use Koha::Database;
22 use Koha::Patrons;
23 use t::lib::TestBuilder;
24
25 use Test::More tests => 3;
26
27 my $schema = Koha::Database->new->schema;
28 use_ok('Koha::Illrequestattribute');
29 use_ok('Koha::Illrequestattributes');
30
31 subtest 'Basic object tests' => sub {
32
33     plan tests => 5;
34
35     $schema->storage->txn_begin;
36
37     Koha::Illrequestattributes->search->delete;
38
39     my $builder = t::lib::TestBuilder->new;
40
41     my $illrqattr = $builder->build({ source => 'Illrequestattribute' });
42
43     my $illrqattr_obj = Koha::Illrequestattributes->find(
44         $illrqattr->{illrequest_id},
45         $illrqattr->{type}
46     );
47     isa_ok($illrqattr_obj, 'Koha::Illrequestattribute',
48         "Correctly create and load an illrequestattribute object.");
49     is($illrqattr_obj->illrequest_id, $illrqattr->{illrequest_id},
50        "Illrequest_id getter works.");
51     is($illrqattr_obj->type, $illrqattr->{type},
52        "Type getter works.");
53     is($illrqattr_obj->value, $illrqattr->{value},
54        "Value getter works.");
55
56     $illrqattr_obj->delete;
57
58     is(Koha::Illrequestattributes->search->count, 0,
59         "No attributes found after delete.");
60
61     $schema->storage->txn_rollback;
62 };
63
64 1;