Bugzilla – Attachment 66922 Details for
Bug 15339
TestBuilder build parameter warnings
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15339: TestBuilder warnings (tests)
Bug-15339-TestBuilder-warnings-tests.patch (text/plain), 2.13 KB, created by
Marcel de Rooy
on 2017-09-07 10:10:06 UTC
(
hide
)
Description:
Bug 15339: TestBuilder warnings (tests)
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2017-09-07 10:10:06 UTC
Size:
2.13 KB
patch
obsolete
>From 0f5f7043aa6b9eb274c3fb69a2ebee2c6b96f7cf Mon Sep 17 00:00:00 2001 >From: Martin Persson <xarragon@gmail.com> >Date: Wed, 9 Dec 2015 11:31:12 +0100 >Subject: [PATCH] Bug 15339: TestBuilder warnings (tests) >Content-Type: text/plain; charset=utf-8 > >Makes TestBuilder::build() alert the user when unreognized parameters >are passed, which happens when the user supplies the column values >directly, forgetting the 'value' hash. > >This patch contains the tests that doubles as a demonstration >of the kind of error the patch is intended to prevent. > >Sponsored-By: Halland County Library > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > t/db_dependent/TestBuilder.t | 24 ++++++++++++++++++++++-- > 1 file changed, 22 insertions(+), 2 deletions(-) > >diff --git a/t/db_dependent/TestBuilder.t b/t/db_dependent/TestBuilder.t >index 03f58eb..c370b5a 100644 >--- a/t/db_dependent/TestBuilder.t >+++ b/t/db_dependent/TestBuilder.t >@@ -19,7 +19,7 @@ > > use Modern::Perl; > >-use Test::More tests => 12; >+use Test::More tests => 13; > use Test::Warn; > use File::Basename qw(dirname); > >@@ -332,7 +332,6 @@ subtest 'Date handling' => sub { > my $patron = $builder->build( { source => 'Borrower' } ); > is( length( $patron->{updated_on} ), 19, 'A timestamp column value should be YYYY-MM-DD HH:MM:SS' ); > is( length( $patron->{dateofbirth} ), 10, 'A date column value should be YYYY-MM-DD' ); >- > }; > > subtest 'Default values' => sub { >@@ -391,4 +390,25 @@ subtest 'build_object() tests' => sub { > }; > }; > >+subtest '->build parameter' => sub { >+ plan tests => 2; >+ >+ # Test to make sure build() warns user of unknown parameters. >+ warnings_are { >+ $builder->build({ >+ source => 'Branch', >+ values => { >+ branchcode => 'BRANCH_1' >+ } >+ }) >+ } [], "No warnings on correct use"; >+ >+ warnings_like { >+ $builder->build({ >+ source => 'Branch', >+ branchcode => 'BRANCH_2' # This is wrong! >+ }) >+ } qr/unknown param/i, "Carp unknown parameters"; >+}; >+ > $schema->storage->txn_rollback; >-- >2.1.4
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 15339
:
45527
|
45528
|
66892
|
66893
|
66894
|
66921
| 66922 |
66923
|
66924
|
66951