Bug 22302: Unit tests
authorNick Clemens <nick@bywatersolutions.com>
Tue, 4 Feb 2020 14:15:36 +0000 (14:15 +0000)
committerHayley Mapley <hayleymapley@catalyst.net.nz>
Thu, 20 Feb 2020 01:41:27 +0000 (14:41 +1300)
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
(cherry picked from commit 91294e26237e60353dd36dae13029e9ee8d157cb)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit dd5d08d66bf787eab865562e482a85b5f41a5df6)

Signed-off-by: Hayley Mapley <hayleymapley@catalyst.net.nz>

t/db_dependent/Koha.t

index 4e814a0..e216878 100644 (file)
@@ -240,13 +240,15 @@ subtest 'ISBN tests' => sub {
 };
 
 subtest 'GetItemTypesCategorized test' => sub{
-    plan tests => 7;
+    plan tests => 9;
 
     my $avc = Koha::AuthorisedValueCategories->find('ITEMTYPECAT');
     Koha::AuthorisedValueCategory->new({ category_name => 'ITEMTYPECAT' })->store unless $avc;
     my $insertGroup = Koha::AuthorisedValue->new(
         {   category         => 'ITEMTYPECAT',
-            authorised_value => 'Quertyware',
+            authorised_value => 'Qwertyware',
+            lib              => 'Keyboard software',
+            lib_opac         => 'Computer stuff',
         }
     )->store;
 
@@ -270,7 +272,8 @@ subtest 'GetItemTypesCategorized test' => sub{
     # add more data since GetItemTypesCategorized's search is more subtle
     $insertGroup = Koha::AuthorisedValue->new(
         {   category         => 'ITEMTYPECAT',
-            authorised_value => 'Varyheavybook',
+            authorised_value => 'Veryheavybook',
+            lib              => 'Weighty literature',
         }
     )->store;
 
@@ -281,6 +284,9 @@ subtest 'GetItemTypesCategorized test' => sub{
     ok($hrCat->{Veryheavybook} &&
        $hrCat->{Veryheavybook}->{hideinopac}==1, 'GetItemTypesCategorized: non-visible category hidden' );
 
+    is( $hrCat->{Veryheavybook}->{description}, 'Weighty literature', 'A category with only lib description passes through');
+    is( $hrCat->{Qwertyware}->{description}, 'Computer stuff', 'A category with lib_opac description uses that');
+
     $insertSth->execute('BKghjklo5', 'An hidden book', 'Qwertyware', 1);
     $hrCat = GetItemTypesCategorized();
     ok(exists $hrCat->{Qwertyware}, 'GetItemTypesCategorized: partially visible category exists');