Bugzilla – Attachment 84601 Details for
Bug 21610
Koha::Object->store needs to handle incorrect values
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 21610: Add tests
Bug-21610-Add-tests.patch (text/plain), 3.03 KB, created by
Tomás Cohen Arazi (tcohen)
on 2019-02-01 11:02:37 UTC
(
hide
)
Description:
Bug 21610: Add tests
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2019-02-01 11:02:37 UTC
Size:
3.03 KB
patch
obsolete
>From 63a1201c9ee3ff554440dfa96afe2c003b377e0e Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 18 Oct 2018 18:38:18 -0300 >Subject: [PATCH] Bug 21610: Add tests > >Adding few tests to Koha/Object.t in order to highlight what we are >trying to fix. > >Note that Koha::ItemType->store was wrong for notforloan, the default >value should be null > `notforloan` smallint(6) DEFAULT NULL, >but the previous fix (bug 21599) made it default to '0' > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > t/db_dependent/Koha/Object.t | 41 +++++++++++++++++++++++++++++++++++- > 1 file changed, 40 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Koha/Object.t b/t/db_dependent/Koha/Object.t >index cf40ea9666..fb57218afa 100755 >--- a/t/db_dependent/Koha/Object.t >+++ b/t/db_dependent/Koha/Object.t >@@ -242,7 +242,7 @@ subtest "Test update method" => sub { > > subtest 'store() tests' => sub { > >- plan tests => 8; >+ plan tests => 16; > > # Using Koha::ApiKey to test Koha::Object>-store > # Simple object with foreign keys and unique key >@@ -306,6 +306,45 @@ subtest 'store() tests' => sub { > my $ret = $api_key->store; > is( ref($ret), 'Koha::ApiKey', 'store() returns the object on success' ); > >+ my $library = $builder->build_object( { class => 'Koha::Libraries' } ); >+ my $patron_category = $builder->build_object( >+ { >+ class => 'Koha::Patron::Categories', >+ value => { category_type => 'P', enrolmentfee => 0 } >+ } >+ ); >+ >+ $patron = eval { >+ Koha::Patron->new( >+ { >+ categorycode => $patron_category->categorycode, >+ branchcode => $library->branchcode, >+ dateofbirth => "", # date will be set to NULL >+ sms_provider_id => "", # Integer will be set to NULL >+ privacy => "", # privacy cannot be NULL but has a default value >+ } >+ )->store; >+ }; >+ is( $@, '', 'No error should be raised by ->store if empty strings are passed' ); >+ is( $patron->privacy, 1, 'Default value for privacy should be set to 1' ); >+ is( $patron->dateofbirth, undef, 'dateofbirth must have been set to undef'); >+ is( $patron->sms_provider_id, undef, 'sms_provider_id must have been set to undef'); >+ >+ my $itemtype = eval { >+ Koha::ItemType->new( >+ { >+ itemtype => 'IT4test', >+ rentalcharge => "", >+ notforloan => "", >+ hideinopac => "", >+ } >+ )->store; >+ }; >+ is( $@, '', 'No error should be raised by ->store if empty strings are passed' ); >+ is( $itemtype->rentalcharge, undef, 'decimal DEFAULT NULL should default to null'); >+ is( $itemtype->notforloan, undef, 'int DEFAULT NULL should default to null'); >+ is( $itemtype->hideinopac, 0, 'int NOT NULL DEFAULT 0 should default to 0'); >+ > subtest 'Bad value tests' => sub { > > plan tests => 1; >-- >2.20.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 21610
:
80880
|
80881
|
80882
|
80906
|
80926
|
80927
|
81016
|
81017
|
81018
|
81019
|
81020
|
81021
|
84601
|
84602
|
84603
|
84604
|
84605
|
84606
|
84642
|
84643
|
84644
|
84645
|
84646
|
84647