Bugzilla – Attachment 70010 Details for
Bug 19841
AddMember should raise an exception if categorycode is invalid
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19841: Unit tests
Bug-19841-Unit-tests.patch (text/plain), 1.68 KB, created by
Tomás Cohen Arazi (tcohen)
on 2017-12-21 13:11:15 UTC
(
hide
)
Description:
Bug 19841: Unit tests
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2017-12-21 13:11:15 UTC
Size:
1.68 KB
patch
obsolete
>From 061fc0bfa32579410d5ed8ef40e1b40dfe77bdfe Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Wed, 20 Dec 2017 16:19:07 -0300 >Subject: [PATCH] Bug 19841: Unit tests > >This patch introduces unit tests for the new behaviour of AddMember >(raising an exception if the passed categorycode is not valid. > > To test: > - Apply this patch > - Run: > $ kshell > k$ prove t/db_dependent/Members.t >=> FAIL: It should fail because the feature is still not implemented. >--- > t/db_dependent/Members.t | 27 ++++++++++++++++++++++++++- > 1 file changed, 26 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Members.t b/t/db_dependent/Members.t >index a933827a30..78b9558ae6 100755 >--- a/t/db_dependent/Members.t >+++ b/t/db_dependent/Members.t >@@ -17,8 +17,10 @@ > > use Modern::Perl; > >-use Test::More tests => 63; >+use Test::More tests => 64; > use Test::MockModule; >+use Test::Exception; >+ > use Data::Dumper qw/Dumper/; > use C4::Context; > use Koha::Database; >@@ -501,3 +503,26 @@ subtest 'Trivial test for AddMember_Auto' => sub { > }; > > $schema->storage->txn_rollback; >+ >+subtest 'AddMember (invalid categorycode) tests' => sub { >+ plan tests => 1; >+ >+ $schema->storage->txn_begin; >+ >+ my $category = $builder->build_object({ class => 'Koha::Patron::Categories' }); >+ my $category_id = $category->id; >+ # Remove category to make sure the id is not on the DB >+ $category->delete; >+ >+ my $patron_data = { >+ categorycode => $category_id >+ }; >+ >+ throws_ok >+ { AddMember( %{ $patron_data } ); } >+ 'Koha::Exceptions::BadParameter', >+ 'AddMember raises an exception on invalid categorycode'; >+ >+ $schema->storage->txn_rollback; >+}; >+ >-- >2.15.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 19841
:
69966
|
69967
|
69968
|
70010
|
70011
|
70138
|
70147
|
70148