|
Lines 4-25
Link Here
|
| 4 |
# It requires a working Koha database with the sample data |
4 |
# It requires a working Koha database with the sample data |
| 5 |
|
5 |
|
| 6 |
use Modern::Perl; |
6 |
use Modern::Perl; |
|
|
7 |
use DateTime::Format::MySQL; |
| 8 |
use Test::More tests => 8; |
| 9 |
|
| 10 |
use t::lib::TestBuilder; |
| 11 |
|
| 7 |
use C4::Context; |
12 |
use C4::Context; |
|
|
13 |
use Koha::Database; |
| 8 |
use Koha::DateUtils qw(dt_from_string); |
14 |
use Koha::DateUtils qw(dt_from_string); |
| 9 |
use Koha::AuthorisedValue; |
15 |
use Koha::AuthorisedValue; |
| 10 |
use Koha::AuthorisedValueCategories; |
16 |
use Koha::AuthorisedValueCategories; |
| 11 |
|
17 |
|
| 12 |
use Test::More tests => 8; |
|
|
| 13 |
use DateTime::Format::MySQL; |
| 14 |
|
| 15 |
BEGIN { |
18 |
BEGIN { |
| 16 |
use_ok('C4::Koha', qw( :DEFAULT GetDailyQuote GetItemTypesCategorized)); |
19 |
use_ok('C4::Koha', qw( :DEFAULT GetDailyQuote GetItemTypesCategorized)); |
| 17 |
use_ok('C4::Members'); |
20 |
use_ok('C4::Members'); |
| 18 |
} |
21 |
} |
| 19 |
|
22 |
|
|
|
23 |
my $schema = Koha::Database->new->schema; |
| 24 |
$schema->storage->txn_begin; |
| 25 |
my $builder = t::lib::TestBuilder->new; |
| 20 |
my $dbh = C4::Context->dbh; |
26 |
my $dbh = C4::Context->dbh; |
| 21 |
$dbh->{AutoCommit} = 0; |
27 |
|
| 22 |
$dbh->{RaiseError} = 1; |
28 |
our $itype_1 = $builder->build({ source => 'Itemtype' }); |
| 23 |
|
29 |
|
| 24 |
subtest 'Authorized Values Tests' => sub { |
30 |
subtest 'Authorized Values Tests' => sub { |
| 25 |
plan tests => 3; |
31 |
plan tests => 3; |
|
Lines 152-160
subtest 'Authorized Values Tests' => sub {
Link Here
|
| 152 |
}; |
158 |
}; |
| 153 |
|
159 |
|
| 154 |
subtest 'Itemtype info Tests' => sub { |
160 |
subtest 'Itemtype info Tests' => sub { |
| 155 |
like ( getitemtypeinfo('BK')->{'imageurl'}, qr/intranet-tmpl/, 'getitemtypeinfo on unspecified interface returns intranet imageurl (legacy behavior)' ); |
161 |
like ( getitemtypeinfo( $itype_1->{itemtype} )->{'imageurl'}, qr/intranet-tmpl/, 'getitemtypeinfo on unspecified interface returns intranet imageurl (legacy behavior)' ); |
| 156 |
like ( getitemtypeinfo('BK', 'intranet')->{'imageurl'}, qr/intranet-tmpl/, 'getitemtypeinfo on "intranet" interface returns intranet imageurl' ); |
162 |
like ( getitemtypeinfo( $itype_1->{itemtype}, 'intranet')->{'imageurl'}, qr/intranet-tmpl/, 'getitemtypeinfo on "intranet" interface returns intranet imageurl' ); |
| 157 |
like ( getitemtypeinfo('BK', 'opac')->{'imageurl'}, qr/opac-tmpl/, 'getitemtypeinfo on "opac" interface returns opac imageurl' ); |
163 |
like ( getitemtypeinfo( $itype_1->{itemtype}, 'opac')->{'imageurl'}, qr/opac-tmpl/, 'getitemtypeinfo on "opac" interface returns opac imageurl' ); |
| 158 |
}; |
164 |
}; |
| 159 |
|
165 |
|
| 160 |
### test for C4::Koha->GetDailyQuote() |
166 |
### test for C4::Koha->GetDailyQuote() |
|
Lines 303-306
subtest 'GetItemTypes test' => sub {
Link Here
|
| 303 |
is_deeply( $itemtypes, [ 'a', 'd', 'c', 'b' ], 'GetItemTypes(array) should return itemtypes ordered by description'); |
309 |
is_deeply( $itemtypes, [ 'a', 'd', 'c', 'b' ], 'GetItemTypes(array) should return itemtypes ordered by description'); |
| 304 |
}; |
310 |
}; |
| 305 |
|
311 |
|
| 306 |
$dbh->rollback(); |
312 |
$schema->storage->txn_rollback; |