Lines 8-14
use C4::Context;
Link Here
|
8 |
use Koha::DateUtils qw(dt_from_string); |
8 |
use Koha::DateUtils qw(dt_from_string); |
9 |
use Koha::AuthorisedValue; |
9 |
use Koha::AuthorisedValue; |
10 |
|
10 |
|
11 |
use Test::More tests => 9; |
11 |
use Test::More tests => 8; |
12 |
use DateTime::Format::MySQL; |
12 |
use DateTime::Format::MySQL; |
13 |
|
13 |
|
14 |
BEGIN { |
14 |
BEGIN { |
Lines 258-306
subtest 'ISBN tests' => sub {
Link Here
|
258 |
|
258 |
|
259 |
}; |
259 |
}; |
260 |
|
260 |
|
261 |
subtest 'GetFrameworksLoop() tests' => sub { |
|
|
262 |
plan tests => 6; |
263 |
|
264 |
$dbh->do("DELETE FROM biblio_framework"); |
265 |
|
266 |
my $frameworksloop = GetFrameworksLoop(); |
267 |
is ( scalar(@$frameworksloop), 0, 'No frameworks' ); |
268 |
|
269 |
$dbh->do("INSERT INTO biblio_framework ( frameworkcode, frameworktext ) VALUES ( 'A', 'Third framework' )"); |
270 |
$dbh->do("INSERT INTO biblio_framework ( frameworkcode, frameworktext ) VALUES ( 'B', 'Second framework' )"); |
271 |
$dbh->do("INSERT INTO biblio_framework ( frameworkcode, frameworktext ) VALUES ( 'C', 'First framework' )"); |
272 |
|
273 |
$frameworksloop = GetFrameworksLoop(); |
274 |
is ( scalar(@$frameworksloop), 3, 'All frameworks' ); |
275 |
is ( scalar ( grep { defined $_->{'selected'} } @$frameworksloop ), 0, 'None selected' ); |
276 |
|
277 |
$frameworksloop = GetFrameworksLoop( 'B' ); |
278 |
is ( scalar ( grep { defined $_->{'selected'} } @$frameworksloop ), 1, 'One selected' ); |
279 |
my @descriptions = map { $_->{'description'} } @$frameworksloop; |
280 |
is ( $descriptions[0], 'First framework', 'Ordered result' ); |
281 |
cmp_deeply( |
282 |
$frameworksloop, |
283 |
[ |
284 |
{ |
285 |
'value' => 'C', |
286 |
'description' => 'First framework', |
287 |
'selected' => undef, |
288 |
}, |
289 |
{ |
290 |
'value' => 'B', |
291 |
'description' => 'Second framework', |
292 |
'selected' => 1, # selected |
293 |
}, |
294 |
{ |
295 |
'value' => 'A', |
296 |
'description' => 'Third framework', |
297 |
'selected' => undef, |
298 |
} |
299 |
], |
300 |
'Full check, sorted by description with selected val (Bug 12675)' |
301 |
); |
302 |
}; |
303 |
|
304 |
subtest 'GetItemTypesByCategory GetItemTypesCategorized test' => sub{ |
261 |
subtest 'GetItemTypesByCategory GetItemTypesCategorized test' => sub{ |
305 |
plan tests => 7; |
262 |
plan tests => 7; |
306 |
|
263 |
|
307 |
- |
|
|