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