Bugzilla – Attachment 137851 Details for
Bug 31183
Add Koha::Item::Transfers->filter_by_current
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 31183: Unit tests
Bug-31183-Unit-tests.patch (text/plain), 1.77 KB, created by
Tomás Cohen Arazi (tcohen)
on 2022-07-18 21:48:26 UTC
(
hide
)
Description:
Bug 31183: Unit tests
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2022-07-18 21:48:26 UTC
Size:
1.77 KB
patch
obsolete
>From 7df9e3c4efc58a7405d947b1c14323382a3eaddd Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Mon, 18 Jul 2022 18:33:33 -0300 >Subject: [PATCH] Bug 31183: Unit tests > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > t/db_dependent/Koha/Item/Transfers.t | 24 +++++++++++++++++++++++- > 1 file changed, 23 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Koha/Item/Transfers.t b/t/db_dependent/Koha/Item/Transfers.t >index 324842b637..35cce33bcb 100755 >--- a/t/db_dependent/Koha/Item/Transfers.t >+++ b/t/db_dependent/Koha/Item/Transfers.t >@@ -19,7 +19,7 @@ > > use Modern::Perl; > >-use Test::More tests => 3; >+use Test::More tests => 4; > > use Koha::Item::Transfer; > use Koha::Item::Transfers; >@@ -109,3 +109,25 @@ subtest 'daterequested tests' => sub { > > $schema->storage->txn_rollback; > }; >+ >+subtest 'filter_by_current() tests' => sub { >+ >+ plan tests => 3; >+ >+ $schema->storage->txn_begin; >+ >+ my $transfer_1 = $builder->build_object({ class => 'Koha::Item::Transfers', value => { datearrived => \'NOW()', datecancelled => undef } }); >+ my $transfer_2 = $builder->build_object({ class => 'Koha::Item::Transfers', value => { datearrived => undef, datecancelled => \'NOW()' } }); >+ my $transfer_3 = $builder->build_object({ class => 'Koha::Item::Transfers', value => { datearrived => undef, datecancelled => undef } }); >+ >+ my $rs = Koha::Item::Transfers->search({ branchtransfer_id => [ $transfer_1->id, $transfer_2->id, $transfer_3->id ] }); >+ >+ is( $rs->count, 3, 'Resultset has 3 transfers' ); >+ >+ $rs = $rs->filter_by_current; >+ >+ is( $rs->count, 1, 'Filtered resultset has 1 transfer' ); >+ is( $rs->next->id, $transfer_3->id, 'Only current transfer left on the resultset' ); >+ >+ $schema->storage->txn_rollback; >+}; >-- >2.37.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 31183
:
137851
|
137852
|
137853
|
137944
|
137945
|
137946
|
138887
|
138888
|
138889