diff --git a/Koha/Bookings.pm b/Koha/Bookings.pm index d4c89b4278..86eeb3a5c8 100644 --- a/Koha/Bookings.pm +++ b/Koha/Bookings.pm @@ -32,19 +32,6 @@ Koha::Bookings - Koha Booking object set class =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 $bookings->filter_by_active; diff --git a/t/db_dependent/Koha/Bookings.t b/t/db_dependent/Koha/Bookings.t index 9d29e4c2e8..699daaebab 100755 --- a/t/db_dependent/Koha/Bookings.t +++ b/t/db_dependent/Koha/Bookings.t @@ -19,7 +19,7 @@ use Modern::Perl; -use Test::More tests => 2; +use Test::More tests => 1; use Koha::Bookings; use Koha::Database; @@ -31,64 +31,6 @@ my $schema = Koha::Database->new->schema; 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 { plan tests => 5;