Bugzilla – Attachment 138887 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.85 KB, created by
Jonathan Druart
on 2022-08-09 09:34:28 UTC
(
hide
)
Description:
Bug 31183: Unit tests
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2022-08-09 09:34:28 UTC
Size:
1.85 KB
patch
obsolete
>From 9a3c86e3f14ee0af6e22180e1c933a58c145bf98 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> > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > 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 324842b637c..35cce33bcb8 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.25.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