Bug 17431: Create the object we need instead of assuming something exists
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Wed, 19 Oct 2016 13:14:41 +0000 (14:14 +0100)
committerKyle M Hall <kyle@bywatersolutions.com>
Thu, 17 Nov 2016 16:22:31 +0000 (16:22 +0000)
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
t/db_dependent/api/v1/holds.t

index 8e79d19..8395f52 100644 (file)
@@ -41,8 +41,8 @@ $ENV{REMOTE_ADDR} = '127.0.0.1';
 my $t = Test::Mojo->new('Koha::REST::V1');
 my $tx;
 
-my $categorycode = Koha::Database->new()->schema()->resultset('Category')->first()->categorycode();
-my $branchcode = Koha::Database->new()->schema()->resultset('Branch')->first()->branchcode();
+my $categorycode = $builder->build({ source => 'Category' })->{categorycode};
+my $branchcode = $builder->build({ source => 'Branch' })->{branchcode};
 
 # User without any permissions
 my $nopermission = $builder->build({