From c74b7e1ee3ea5cdf05f30a20f9d33b4d130385d7 Mon Sep 17 00:00:00 2001 From: Alex Arnaud Date: Wed, 15 Mar 2017 16:03:53 +0000 Subject: [PATCH] Bug 15336 - Fix unit tests (t/Bookseller.t) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marc VĂ©ron --- t/Bookseller.t | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/t/Bookseller.t b/t/Bookseller.t index 6d6aab3..df724cd 100755 --- a/t/Bookseller.t +++ b/t/Bookseller.t @@ -47,12 +47,12 @@ my $item1 = create('Item', $booksellerid1); my $subscription = create('Subscription', $booksellerid1); -my $bookseller = Koha::Acquisition::Bookseller->fetch({id => $booksellerid1}); +my $bookseller = Koha::Acquisition::Booksellers->find( $booksellerid1 ); -my ($error, $result) = $bookseller->merge_to(345876876); -is($error, "Unknown target bookseller number: 345876876", 'Merge to unknown bookseller return an error' ); +my $result = eval{ $bookseller->merge_with(345876876); }; +like($@, qr/Unknown target bookseller number: 345876876/, 'Merge with unknown bookseller should die.'); -($error, $result) = $bookseller->merge_to($booksellerid2); +$result = $bookseller->merge_with($booksellerid2); my $expected_result = { Aqbasketgroup => [$bg1->{id}, $bg2->{id}], Aqbasket => [$basket1->{basketno}, $basket2->{basketno}], @@ -78,7 +78,7 @@ is(GetBasket($basket2->{basketno})->{'booksellerid'}, $booksellerid2, 'Basket 2 is(GetContract({contractnumber => $contract->{contractnumber}})->{'booksellerid'}, $booksellerid2, 'Basket 1 has bookseller 2'); -is(C4::Bookseller::Contact->fetch($contact->{id})->{'booksellerid'}, $booksellerid2, 'Contact 1 has booksellerid 2'); +is(Koha::Acquisition::Bookseller::Contacts->find( $contact->{id} )->booksellerid, $booksellerid2, 'Contact 1 has booksellerid 2'); is(GetInvoice($invoice->{invoiceid})->{'booksellerid'}, $booksellerid2, 'Invoice has bookseller 2'); -- 2.1.4