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