Bugzilla – Attachment 45528 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), 1.48 KB, created by
Martin Persson
on 2015-12-09 12:27:20 UTC
(
hide
)
Description:
Bug 15339: TestBuilder warnings (tests)
Filename:
MIME Type:
Creator:
Martin Persson
Created:
2015-12-09 12:27:20 UTC
Size:
1.48 KB
patch
obsolete
>From edb334e31b7b1c5e6acec7d8d8f7ffcc3a054f85 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) > >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 >--- > t/db_dependent/TestBuilder.t | 20 +++++++++++++++++++- > 1 file changed, 19 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/TestBuilder.t b/t/db_dependent/TestBuilder.t >index 638d2ef..74b5988 100644 >--- a/t/db_dependent/TestBuilder.t >+++ b/t/db_dependent/TestBuilder.t >@@ -19,7 +19,8 @@ > > use Modern::Perl; > >-use Test::More tests => 42; >+use Test::More tests => 44; >+use Test::Warn; > > use Koha::Database; > >@@ -280,6 +281,23 @@ subtest 'Auto-increment values tests' => sub { > > }; > >+# 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; > > 1; >-- >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