Bug 31907: (QA follow-up) Simplify tests
This patch simplipfies the tests, and highlighs the fact the introduced method should add filters to the current resultset. It also aligns the tests with the currently adopted style. Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
parent
50031319db
commit
bc7f1c820e
1 changed files with 12 additions and 27 deletions
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
use Modern::Perl;
|
use Modern::Perl;
|
||||||
|
|
||||||
use Test::More tests => 9;
|
use Test::More tests => 10;
|
||||||
use Test::Warn;
|
use Test::Warn;
|
||||||
|
|
||||||
use C4::Circulation qw( AddIssue );
|
use C4::Circulation qw( AddIssue );
|
||||||
|
@ -745,52 +745,37 @@ subtest 'filter_by_has_cancellation_requests() and filter_out_has_cancellation_r
|
||||||
$schema->storage->txn_rollback;
|
$schema->storage->txn_rollback;
|
||||||
};
|
};
|
||||||
|
|
||||||
subtest 'get holds in processing' => sub {
|
subtest 'processing() tests' => sub {
|
||||||
|
|
||||||
plan tests => 1;
|
plan tests => 3;
|
||||||
|
|
||||||
$schema->storage->txn_begin;
|
$schema->storage->txn_begin;
|
||||||
|
|
||||||
my $patron = $builder->build_object( { class => 'Koha::Patrons' } );
|
|
||||||
|
|
||||||
my $item = $builder->build_sample_item;
|
|
||||||
|
|
||||||
my $hold_1 = $builder->build_object(
|
my $hold_1 = $builder->build_object(
|
||||||
{
|
{
|
||||||
class => 'Koha::Holds',
|
class => 'Koha::Holds',
|
||||||
value => {
|
value => { found => 'P' }
|
||||||
found => 'P',
|
|
||||||
itemnumber => $item->id,
|
|
||||||
biblionumber => $item->biblionumber,
|
|
||||||
borrowernumber => $patron->id
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
my $hold_2 = $builder->build_object(
|
my $hold_2 = $builder->build_object(
|
||||||
{
|
{
|
||||||
class => 'Koha::Holds',
|
class => 'Koha::Holds',
|
||||||
value => {
|
value => { found => undef }
|
||||||
found => undef,
|
|
||||||
itemnumber => $item->id,
|
|
||||||
biblionumber => $item->biblionumber,
|
|
||||||
borrowernumber => $patron->id
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
my $hold_3 = $builder->build_object(
|
my $hold_3 = $builder->build_object(
|
||||||
{
|
{
|
||||||
class => 'Koha::Holds',
|
class => 'Koha::Holds',
|
||||||
value => {
|
value => { found => 'T' }
|
||||||
found => undef,
|
|
||||||
itemnumber => $item->id,
|
|
||||||
biblionumber => $item->biblionumber,
|
|
||||||
borrowernumber => $patron->id
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
my $processing_holds = $item->holds->processing;
|
my $holds = Koha::Holds->search({ reserve_id => [ $hold_1->id, $hold_2->id, $hold_3->id ] });
|
||||||
is( $processing_holds->count, 1 );
|
is( $holds->count, 3, 'Resultset contains 3 holds' );
|
||||||
|
|
||||||
|
my $processing = $holds->processing;
|
||||||
|
is( $processing->count, 1 );
|
||||||
|
is( $processing->next->id, $hold_1->id, "First hold is the only one in 'processing'" );
|
||||||
|
|
||||||
$schema->storage->txn_rollback;
|
$schema->storage->txn_rollback;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue