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 252-300
subtest 'ISBN tests' => sub {
Link Here
|
252 |
|
252 |
|
253 |
}; |
253 |
}; |
254 |
|
254 |
|
255 |
subtest 'GetFrameworksLoop() tests' => sub { |
|
|
256 |
plan tests => 6; |
257 |
|
258 |
$dbh->do("DELETE FROM biblio_framework"); |
259 |
|
260 |
my $frameworksloop = GetFrameworksLoop(); |
261 |
is ( scalar(@$frameworksloop), 0, 'No frameworks' ); |
262 |
|
263 |
$dbh->do("INSERT INTO biblio_framework ( frameworkcode, frameworktext ) VALUES ( 'A', 'Third framework' )"); |
264 |
$dbh->do("INSERT INTO biblio_framework ( frameworkcode, frameworktext ) VALUES ( 'B', 'Second framework' )"); |
265 |
$dbh->do("INSERT INTO biblio_framework ( frameworkcode, frameworktext ) VALUES ( 'C', 'First framework' )"); |
266 |
|
267 |
$frameworksloop = GetFrameworksLoop(); |
268 |
is ( scalar(@$frameworksloop), 3, 'All frameworks' ); |
269 |
is ( scalar ( grep { defined $_->{'selected'} } @$frameworksloop ), 0, 'None selected' ); |
270 |
|
271 |
$frameworksloop = GetFrameworksLoop( 'B' ); |
272 |
is ( scalar ( grep { defined $_->{'selected'} } @$frameworksloop ), 1, 'One selected' ); |
273 |
my @descriptions = map { $_->{'description'} } @$frameworksloop; |
274 |
is ( $descriptions[0], 'First framework', 'Ordered result' ); |
275 |
cmp_deeply( |
276 |
$frameworksloop, |
277 |
[ |
278 |
{ |
279 |
'value' => 'C', |
280 |
'description' => 'First framework', |
281 |
'selected' => undef, |
282 |
}, |
283 |
{ |
284 |
'value' => 'B', |
285 |
'description' => 'Second framework', |
286 |
'selected' => 1, # selected |
287 |
}, |
288 |
{ |
289 |
'value' => 'A', |
290 |
'description' => 'Third framework', |
291 |
'selected' => undef, |
292 |
} |
293 |
], |
294 |
'Full check, sorted by description with selected val (Bug 12675)' |
295 |
); |
296 |
}; |
297 |
|
298 |
subtest 'GetItemTypesByCategory GetItemTypesCategorized test' => sub{ |
255 |
subtest 'GetItemTypesByCategory GetItemTypesCategorized test' => sub{ |
299 |
plan tests => 7; |
256 |
plan tests => 7; |
300 |
|
257 |
|
301 |
- |
|
|