Browse Source

Bug 26582: (QA follow-up) Rename closed => is_closed

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
20.11.x
Tomas Cohen Arazi 12 months ago
committed by Jonathan Druart
parent
commit
83bb93ccc9
  1. 8
      Koha/Acquisition/Basket.pm
  2. 8
      t/db_dependent/Koha/Acquisition/Basket.t

8
Koha/Acquisition/Basket.pm

@ -156,15 +156,15 @@ sub authorizer {
return scalar Koha::Patrons->find($self->authorisedby);
}
=head3 closed
=head3 is_closed
if ( $basket->closed ) { ... }
if ( $basket->is_closed ) { ... }
Returns a boolean value representing if the basket is closed.
=cut
sub closed {
sub is_closed {
my ($self) = @_;
return ($self->closedate) ? 1 : 0;
@ -185,7 +185,7 @@ sub close {
my ($self) = @_;
Koha::Exceptions::Acquisition::Basket::AlreadyClosed->throw
if $self->closed;
if $self->is_closed;
$self->_result->result_source->schema->txn_do(
sub {

8
t/db_dependent/Koha/Acquisition/Basket.t

@ -303,7 +303,7 @@ subtest 'orders' => sub {
$schema->storage->txn_rollback;
};
subtest 'closed() tests' => sub {
subtest 'is_closed() tests' => sub {
plan tests => 2;
@ -327,8 +327,8 @@ subtest 'closed() tests' => sub {
}
);
ok( $closed_basket->closed, 'Closed basket is tested as closed' );
ok( !$open_basket->closed, 'Open basket is tested as open' );
ok( $closed_basket->is_closed, 'Closed basket is tested as closed' );
ok( !$open_basket->is_closed, 'Open basket is tested as open' );
$schema->storage->txn_rollback;
};
@ -363,7 +363,7 @@ subtest 'close() tests' => sub {
$basket->close;
ok( $basket->closed, 'Basket is closed' );
ok( $basket->is_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' );

Loading…
Cancel
Save