Bug 19979: Fix get_facets_info test in Search.t
authorMarcel de Rooy <m.de.rooy@rijksmuseum.nl>
Tue, 16 Jan 2018 13:28:36 +0000 (14:28 +0100)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Tue, 27 Feb 2018 14:41:21 +0000 (11:41 -0300)
The test should remove the holdingbranch key in the expected results when
there is only one branch.
See the logic in C4::Koha.

Test plan:
[1] Run Search.t on a database with multiple branches.
[2] Run Search.t on a database with one branch. Without this patch the test
    would fail: Failed test '_get_facets_info returns the correct data'.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
t/db_dependent/Search.t

index ba277bc..ba5e531 100644 (file)
@@ -865,6 +865,8 @@ if ( $indexing_mode eq 'dom' ) {
                 'su-ut' => { 'expanded'    => undef,
                              'label_value' => "Titles" }
     };
+    delete $expected_facets_info_marc21->{holdingbranch}
+        if Koha::Libraries->search->count == 1;
     is_deeply( $facets_info, $expected_facets_info_marc21,
         "_get_facets_info returns the correct data");
 
@@ -959,6 +961,8 @@ sub run_unimarc_search_tests {
                 'su-ut' => { 'expanded'    => undef,
                              'label_value' => "Titles" }
     };
+    delete $expected_facets_info_unimarc->{holdingbranch}
+        if Koha::Libraries->search->count == 1;
     is_deeply( $facets_info, $expected_facets_info_unimarc,
         "_get_facets_info returns the correct data");