Bug 28202: Unit test

Run prove t/db_dependent/Koha/Biblio.t

Note that sort must be case insensitive.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Fridolin Somers 2021-04-23 12:49:33 +02:00 committed by Jonathan Druart
parent 631cd5d8a7
commit 061c4c3f11
1 changed files with 16 additions and 9 deletions

View File

@ -185,7 +185,7 @@ subtest 'is_serial() tests' => sub {
};
subtest 'pickup_locations' => sub {
plan tests => 8;
plan tests => 9;
$schema->storage->txn_begin;
@ -205,14 +205,14 @@ subtest 'pickup_locations' => sub {
my $root2 = $builder->build_object( { class => 'Koha::Library::Groups', value => { ft_local_hold_group => 1 } } );
my $root3 = $builder->build_object( { class => 'Koha::Library::Groups', value => { ft_local_hold_group => 1 } } );
my $library1 = $builder->build_object( { class => 'Koha::Libraries', value => { pickup_location => 1 } } );
my $library2 = $builder->build_object( { class => 'Koha::Libraries', value => { pickup_location => 1 } } );
my $library3 = $builder->build_object( { class => 'Koha::Libraries', value => { pickup_location => 0 } } );
my $library4 = $builder->build_object( { class => 'Koha::Libraries', value => { pickup_location => 1 } } );
my $library5 = $builder->build_object( { class => 'Koha::Libraries', value => { pickup_location => 1 } } );
my $library6 = $builder->build_object( { class => 'Koha::Libraries', value => { pickup_location => 1 } } );
my $library7 = $builder->build_object( { class => 'Koha::Libraries', value => { pickup_location => 1 } } );
my $library8 = $builder->build_object( { class => 'Koha::Libraries', value => { pickup_location => 0 } } );
my $library1 = $builder->build_object( { class => 'Koha::Libraries', value => { pickup_location => 1, branchname => 'zzz' } } );
my $library2 = $builder->build_object( { class => 'Koha::Libraries', value => { pickup_location => 1, branchname => 'AAA' } } );
my $library3 = $builder->build_object( { class => 'Koha::Libraries', value => { pickup_location => 0, branchname => 'FFF' } } );
my $library4 = $builder->build_object( { class => 'Koha::Libraries', value => { pickup_location => 1, branchname => 'CCC' } } );
my $library5 = $builder->build_object( { class => 'Koha::Libraries', value => { pickup_location => 1, branchname => 'eee' } } );
my $library6 = $builder->build_object( { class => 'Koha::Libraries', value => { pickup_location => 1, branchname => 'BBB' } } );
my $library7 = $builder->build_object( { class => 'Koha::Libraries', value => { pickup_location => 1, branchname => 'DDD' } } );
my $library8 = $builder->build_object( { class => 'Koha::Libraries', value => { pickup_location => 0, branchname => 'GGG' } } );
our @branchcodes = map { $_->branchcode } ($library1, $library2, $library3, $library4, $library5, $library6, $library7, $library8);
@ -413,6 +413,13 @@ subtest 'pickup_locations' => sub {
}
}
my @pl_names = map { $_->branchname } $biblio1->pickup_locations( { patron => $patron1 } )->as_list;
my $pl_ori_str = join('|', @pl_names);
my $pl_sorted_str = join('|', sort { lc($a) cmp lc($b) } @pl_names);
ok(
$pl_ori_str eq $pl_sorted_str,
'Libraries must be sorted by name'
);
$schema->storage->txn_rollback;
};