View | Details | Raw Unified | Return to bug 12675
Collapse All | Expand All

(-)a/t/db_dependent/Koha.t (-2 / +46 lines)
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 => 7;
11
use Test::More tests => 8;
12
use DateTime::Format::MySQL;
12
use DateTime::Format::MySQL;
13
13
14
BEGIN {
14
BEGIN {
Lines 261-263 subtest 'getFacets() tests' => sub { Link Here
261
        'location facet present with singleBranchMode on (bug 10078)'
261
        'location facet present with singleBranchMode on (bug 10078)'
262
    );
262
    );
263
};
263
};
264
- 
264
265
subtest 'GetFrameworksLoop() tests' => sub {
266
    plan tests => 6;
267
268
    $dbh->do("DELETE FROM biblio_framework");
269
270
    my $frameworksloop = GetFrameworksLoop();
271
    is ( scalar(@$frameworksloop), 0, 'No frameworks' );
272
273
    $dbh->do("INSERT INTO biblio_framework ( frameworkcode, frameworktext ) VALUES ( 'A', 'Third framework'  )");
274
    $dbh->do("INSERT INTO biblio_framework ( frameworkcode, frameworktext ) VALUES ( 'B', 'Second framework' )");
275
    $dbh->do("INSERT INTO biblio_framework ( frameworkcode, frameworktext ) VALUES ( 'C', 'First framework'  )");
276
277
    $frameworksloop = GetFrameworksLoop();
278
    is ( scalar(@$frameworksloop), 3, 'All frameworks' );
279
    is ( scalar ( grep { defined $_->{'selected'} } @$frameworksloop ), 0, 'None selected' );
280
281
    $frameworksloop = GetFrameworksLoop( 'B' );
282
    is ( scalar ( grep { defined $_->{'selected'} } @$frameworksloop ), 1, 'One selected' );
283
    my @descriptions = map { $_->{'description'} } @$frameworksloop;
284
    is ( $descriptions[0], 'First framework', 'Ordered result' );
285
    cmp_deeply(
286
        $frameworksloop,
287
        [
288
            {
289
                'value' => 'C',
290
                'description' => 'First framework',
291
                'selected' => undef,
292
            },
293
            {
294
                'value' => 'B',
295
                'description' => 'Second framework',
296
                'selected' => 1,                # selected
297
            },
298
            {
299
                'value' => 'A',
300
                'description' => 'Third framework',
301
                'selected' => undef,
302
            }
303
        ],
304
        'Full check, sorted by description with selected val (Bug 12675)'
305
    );
306
307
    $dbh->rollback();
308
};

Return to bug 12675