Bug 22922: Allow to modify hold dates on reserve/request.pl
[koha.git] / t / Members_AttributeTypes.t
blob42b04d57d4565ae25911c114dbe78914d14523c4
1 #!/usr/bin/perl
3 # This file is part of Koha.
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.
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.
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>.
18 use Modern::Perl;
20 use Test::MockModule;
21 use Test::More;
23 use Module::Load::Conditional qw/check_install/;
25 BEGIN {
26 if ( check_install( module => 'Test::DBIx::Class' ) ) {
27 plan tests => 8;
28 } else {
29 plan skip_all => "Need Test::DBIx::Class"
33 use_ok('C4::Members::AttributeTypes');
35 use Test::DBIx::Class;
37 fixtures_ok [
38 Category => [
39 ['categorycode'],
40 ['orange'], ['yellow'],
42 BorrowerAttributeType => [
44 'code', 'description',
45 'repeatable', 'unique_id',
46 'opac_display',
47 'staff_searchable', 'authorised_value_category',
48 'display_checkout', 'category_code',
49 'class'
51 [ 'one', 'ISBN', '1', '1', '1', '1', 'red', '1', 'orange', 'green' ],
52 [ 'two', 'ISSN', '0', '0', '0', '0', 'blue', '0', 'yellow', 'silver' ]
55 ], 'add fixtures';
57 my $db = Test::MockModule->new('Koha::Database');
58 $db->mock( _new_schema => sub { return Schema(); } );
60 my @members_attributetypes = C4::Members::AttributeTypes::GetAttributeTypes(undef, 1);
62 is( $members_attributetypes[0]->{'code'}, 'one', 'First code value is one' );
64 is( $members_attributetypes[1]->{'code'}, 'two', 'Second code value is two' );
66 is( $members_attributetypes[0]->{'class'},
67 'green', 'First class value is green' );
69 is( $members_attributetypes[1]->{'class'},
70 'silver', 'Second class value is silver' );
72 ok( C4::Members::AttributeTypes->fetch('one'), "testing fetch feature" );
74 ok( !C4::Members::AttributeTypes->fetch('FAKE'),
75 "testing fetch feature doesn't work if value not in database" );