Bug 26132: (QA follow-up) Make tests more robust
authorTomas Cohen Arazi <tomascohen@theke.io>
Wed, 12 Aug 2020 17:44:52 +0000 (14:44 -0300)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Thu, 13 Aug 2020 08:15:33 +0000 (10:15 +0200)
Tests fail is SearchEngine is set to Elasticsearch. This patch makes
tests build 'real' biblios.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

t/db_dependent/Koha/ItemTypes.t

index 7f5e9e8..22a8bd6 100755 (executable)
@@ -124,13 +124,13 @@ my $item_type = $builder->build_object({ class => 'Koha::ItemTypes' });
 
 is( $item_type->can_be_deleted, 1, 'An item type that is not used can be deleted');
 
-my $item = $builder->build_object({ class => 'Koha::Items', value => { itype => $item_type->itemtype }});
+my $item = $builder->build_sample_item({ itype => $item_type->itemtype });
 is( $item_type->can_be_deleted, 0, 'An item type that is used by an item cannot be deleted' );
 $item->delete;
 
-my $biblioitem = $builder->build_object({ class => 'Koha::Biblioitems', value => { itemtype => $item_type->itemtype }});
+my $biblio = $builder->build_sample_biblio({ itemtype => $item_type->itemtype });
 is ( $item_type->can_be_deleted, 0, 'An item type that is used by an item and a biblioitem cannot be deleted' );
-$biblioitem->delete;
+$biblio->delete;
 
 is ( $item_type->can_be_deleted, 1, 'The item type that was being used by the removed item and biblioitem can now be deleted' );