Bugzilla – Attachment 111032 Details for
Bug 26582
Add Koha::Acquisition::Basket->close
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 26582: Unit tests
Bug-26582-Unit-tests.patch (text/plain), 2.66 KB, created by
Martin Renvoize (ashimema)
on 2020-10-01 11:26:01 UTC
(
hide
)
Description:
Bug 26582: Unit tests
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2020-10-01 11:26:01 UTC
Size:
2.66 KB
patch
obsolete
>From f6836553ffc8cd3e842c7ebba06cfb878c09db40 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Wed, 30 Sep 2020 14:40:36 -0300 >Subject: [PATCH] Bug 26582: Unit tests > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > t/db_dependent/Koha/Acquisition/Basket.t | 76 +++++++++++++++++++++++- > 1 file changed, 75 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Koha/Acquisition/Basket.t b/t/db_dependent/Koha/Acquisition/Basket.t >index cd2e09d3f0..0570e244d4 100755 >--- a/t/db_dependent/Koha/Acquisition/Basket.t >+++ b/t/db_dependent/Koha/Acquisition/Basket.t >@@ -19,7 +19,9 @@ > > use Modern::Perl; > >-use Test::More tests => 10; >+use Test::More tests => 12; >+use Test::Exception; >+ > use t::lib::TestBuilder; > use t::lib::Mocks; > >@@ -300,3 +302,75 @@ subtest 'orders' => sub { > > $schema->storage->txn_rollback; > }; >+ >+subtest 'closed() tests' => sub { >+ >+ plan tests => 2; >+ >+ $schema->storage->txn_begin; >+ >+ my $open_basket = $builder->build_object( >+ { >+ class => 'Koha::Acquisition::Baskets', >+ value => { >+ closedate => undef >+ } >+ } >+ ); >+ >+ my $closed_basket = $builder->build_object( >+ { >+ class => 'Koha::Acquisition::Baskets', >+ value => { >+ closedate => \'NOW()' >+ } >+ } >+ ); >+ >+ ok( $closed_basket->closed, 'Closed basket is tested as closed' ); >+ ok( !$open_basket->closed, 'Open basket is tested as open' ); >+ >+ $schema->storage->txn_rollback; >+}; >+ >+subtest 'close() tests' => sub { >+ >+ plan tests => 3; >+ >+ $schema->storage->txn_begin; >+ >+ # Create an open basket >+ my $basket = $builder->build_object( >+ { >+ class => 'Koha::Acquisition::Baskets', >+ value => { >+ closedate => undef >+ } >+ } >+ ); >+ >+ for my $status ( qw( new ordered partial complete cancelled ) ) { >+ $builder->build_object( >+ { >+ class => 'Koha::Acquisition::Orders', >+ value => { >+ basketno => $basket->id, >+ orderstatus => $status >+ } >+ } >+ ); >+ } >+ >+ $basket->close; >+ >+ ok( $basket->closed, 'Basket is closed' ); >+ my $ordered_orders = $basket->orders->search({ orderstatus => 'ordered' }); >+ is( $ordered_orders->count, 3, 'Only open orders have been marked as ordered' ); >+ >+ throws_ok >+ { $basket->close; } >+ 'Koha::Exceptions::Acquisition::Basket::AlreadyClosed', >+ 'Trying to close an already closed basket throws an exception'; >+ >+ $schema->storage->txn_rollback; >+}; >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 26582
:
111003
|
111004
|
111032
|
111033
|
111528
|
111529
|
111748