Bugzilla – Attachment 82750 Details for
Bug 21912
Koha::Objects->search lacks tests
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 21912: Add tests for Koha::Objects->search
Bug-21912-Add-tests-for-KohaObjects-search.patch (text/plain), 1.77 KB, created by
Martin Renvoize (ashimema)
on 2018-11-29 15:33:11 UTC
(
hide
)
Description:
Bug 21912: Add tests for Koha::Objects->search
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2018-11-29 15:33:11 UTC
Size:
1.77 KB
patch
obsolete
>From fbc70bc8d9de8b049dfdc51d189c285fa5252793 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Thu, 29 Nov 2018 11:59:05 -0300 >Subject: [PATCH] Bug 21912: Add tests for Koha::Objects->search > >This patch adds simple tests for the current behaviour. Specifically the >return values in both scalar and list context. > >To test: >- Apply this patch >- Run: > $ prove t/db_dependent/Koha/Objects.t >=> SUCCESS: Tests pass >- Sign off :-D > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > t/db_dependent/Koha/Objects.t | 28 +++++++++++++++++++++++++++- > 1 file changed, 27 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Koha/Objects.t b/t/db_dependent/Koha/Objects.t >index bfa6f7d912..5e00ef93e2 100644 >--- a/t/db_dependent/Koha/Objects.t >+++ b/t/db_dependent/Koha/Objects.t >@@ -19,7 +19,7 @@ > > use Modern::Perl; > >-use Test::More tests => 14; >+use Test::More tests => 15; > use Test::Exception; > use Test::Warn; > >@@ -254,3 +254,29 @@ subtest '->is_paged and ->pager tests' => sub { > > $schema->storage->txn_rollback; > }; >+ >+subtest '->search() tests' => sub { >+ >+ plan tests => 12; >+ >+ $schema->storage->txn_begin; >+ >+ Koha::Patrons->delete; >+ >+ # Create 10 patrons >+ foreach (1..10) { >+ $builder->build_object({ class => 'Koha::Patrons' }); >+ } >+ >+ my $patrons = Koha::Patrons->search(); >+ is( ref($patrons), 'Koha::Patrons', 'search in scalar context returns the Koha::Object-based type' ); >+ my @patrons = Koha::Patrons->search(); >+ is( scalar @patrons, 10, 'search in list context returns a list of objects' ); >+ my $i = 0; >+ foreach (1..10) { >+ is( ref($patrons[$i]), 'Koha::Patron', 'Objects in the list have the singular type' ); >+ $i++; >+ } >+ >+ $schema->storage->txn_rollback; >+}; >-- >2.19.2
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 21912
:
82745
| 82750 |
83514