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>
(cherry picked from commit 39920e03f1
)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
parent
77e2d0d0f6
commit
bb44f6971d
2 changed files with 1 additions and 72 deletions
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue