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