|
Lines 239-287
subtest 'ISBN tests' => sub {
Link Here
|
| 239 |
|
239 |
|
| 240 |
}; |
240 |
}; |
| 241 |
|
241 |
|
| 242 |
subtest 'GetFrameworksLoop() tests' => sub { |
|
|
| 243 |
plan tests => 6; |
| 244 |
|
| 245 |
$dbh->do("DELETE FROM biblio_framework"); |
| 246 |
|
| 247 |
my $frameworksloop = GetFrameworksLoop(); |
| 248 |
is ( scalar(@$frameworksloop), 0, 'No frameworks' ); |
| 249 |
|
| 250 |
$dbh->do("INSERT INTO biblio_framework ( frameworkcode, frameworktext ) VALUES ( 'A', 'Third framework' )"); |
| 251 |
$dbh->do("INSERT INTO biblio_framework ( frameworkcode, frameworktext ) VALUES ( 'B', 'Second framework' )"); |
| 252 |
$dbh->do("INSERT INTO biblio_framework ( frameworkcode, frameworktext ) VALUES ( 'C', 'First framework' )"); |
| 253 |
|
| 254 |
$frameworksloop = GetFrameworksLoop(); |
| 255 |
is ( scalar(@$frameworksloop), 3, 'All frameworks' ); |
| 256 |
is ( scalar ( grep { defined $_->{'selected'} } @$frameworksloop ), 0, 'None selected' ); |
| 257 |
|
| 258 |
$frameworksloop = GetFrameworksLoop( 'B' ); |
| 259 |
is ( scalar ( grep { defined $_->{'selected'} } @$frameworksloop ), 1, 'One selected' ); |
| 260 |
my @descriptions = map { $_->{'description'} } @$frameworksloop; |
| 261 |
is ( $descriptions[0], 'First framework', 'Ordered result' ); |
| 262 |
cmp_deeply( |
| 263 |
$frameworksloop, |
| 264 |
[ |
| 265 |
{ |
| 266 |
'value' => 'C', |
| 267 |
'description' => 'First framework', |
| 268 |
'selected' => undef, |
| 269 |
}, |
| 270 |
{ |
| 271 |
'value' => 'B', |
| 272 |
'description' => 'Second framework', |
| 273 |
'selected' => 1, # selected |
| 274 |
}, |
| 275 |
{ |
| 276 |
'value' => 'A', |
| 277 |
'description' => 'Third framework', |
| 278 |
'selected' => undef, |
| 279 |
} |
| 280 |
], |
| 281 |
'Full check, sorted by description with selected val (Bug 12675)' |
| 282 |
); |
| 283 |
}; |
| 284 |
|
| 285 |
subtest 'GetItemTypesByCategory GetItemTypesCategorized test' => sub{ |
242 |
subtest 'GetItemTypesByCategory GetItemTypesCategorized test' => sub{ |
| 286 |
plan tests => 7; |
243 |
plan tests => 7; |
| 287 |
|
244 |
|
| 288 |
- |
|
|