Bug 36428: (QA follow-up) Remove filter_by_future

I actually already started to remove this in another bug, but it makes
sense to do it here where we're introducing the 'active' filter.  I'm in
agreement that this should probably always have been an 'active' rather
than 'future' filtering.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Martin Renvoize 2024-06-20 11:05:07 +01:00 committed by Katrin Fischer
parent 859e84417e
commit 39920e03f1
Signed by: kfischer
GPG key ID: 0EF6E2C03357A834
2 changed files with 1 additions and 72 deletions

View file

@ -32,19 +32,6 @@ Koha::Bookings - Koha Booking object set class
=head2 Class Methods =head2 Class Methods
=head3 filter_by_future
$bookings->filter_by_future;
Will return the bookings starting from now.
=cut
sub filter_by_future {
my ($self) = @_;
return $self->search( { start_date => { '>' => \'NOW()' } } );
}
=head3 filter_by_active =head3 filter_by_active
$bookings->filter_by_active; $bookings->filter_by_active;

View file

@ -19,7 +19,7 @@
use Modern::Perl; use Modern::Perl;
use Test::More tests => 2; use Test::More tests => 1;
use Koha::Bookings; use Koha::Bookings;
use Koha::Database; use Koha::Database;
@ -31,64 +31,6 @@ my $schema = Koha::Database->new->schema;
my $builder = t::lib::TestBuilder->new; my $builder = t::lib::TestBuilder->new;
subtest 'filter_by_future' => sub {
plan tests => 2;
$schema->storage->txn_begin;
my $biblio = $builder->build_sample_biblio;
$builder->build_object(
{
class => 'Koha::Bookings',
value => {
biblio_id => $biblio->biblionumber,
start_date => dt_from_string->subtract( days => 1 )->truncate( to => 'day' ),
end_date => undef
}
}
);
$builder->build_object(
{
class => 'Koha::Bookings',
value => {
biblio_id => $biblio->biblionumber,
start_date => dt_from_string->add( days => 1 )->truncate( to => 'day' ),
end_date => undef
}
}
);
$builder->build_object(
{
class => 'Koha::Bookings',
value => {
biblio_id => $biblio->biblionumber,
start_date => dt_from_string->add( days => 2 )->truncate( to => 'day' ),
end_date => undef
}
}
);
is( $biblio->bookings->filter_by_future->count, 2, 'There should have 2 bookings starting after now' );
$builder->build_object(
{
class => 'Koha::Bookings',
value => {
biblio_id => $biblio->biblionumber,
start_date => dt_from_string->truncate( to => 'day' ),
end_date => undef
}
}
);
is( $biblio->bookings->filter_by_future->count, 2, 'Current day is not considered future' );
$schema->storage->txn_rollback;
};
subtest 'filter_by_active' => sub { subtest 'filter_by_active' => sub {
plan tests => 5; plan tests => 5;