Bugzilla – Attachment 119015 Details for
Bug 25946
borrowerRelationship can no longer be empty
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25946: (QA follow-up) Add Unit tests
Bug-25946-QA-follow-up-Add-Unit-tests.patch (text/plain), 2.27 KB, created by
Martin Renvoize (ashimema)
on 2021-03-30 14:48:10 UTC
(
hide
)
Description:
Bug 25946: (QA follow-up) Add Unit tests
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2021-03-30 14:48:10 UTC
Size:
2.27 KB
patch
obsolete
>From 4bb0d63440b36970121e3f61ab2ed7eb809377e2 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Tue, 30 Mar 2021 15:47:12 +0100 >Subject: [PATCH] Bug 25946: (QA follow-up) Add Unit tests > >Add a unit test for the empty relationship availability. > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > t/db_dependent/Koha/Patron/Relationship.t | 32 +++++++++++++++++++++-- > 1 file changed, 30 insertions(+), 2 deletions(-) > >diff --git a/t/db_dependent/Koha/Patron/Relationship.t b/t/db_dependent/Koha/Patron/Relationship.t >index 380aaa2ea6..495afad126 100755 >--- a/t/db_dependent/Koha/Patron/Relationship.t >+++ b/t/db_dependent/Koha/Patron/Relationship.t >@@ -35,7 +35,7 @@ my $builder = t::lib::TestBuilder->new; > > subtest 'store() tests' => sub { > >- plan tests => 9; >+ plan tests => 13; > > $schema->storage->txn_begin; > >@@ -76,7 +76,23 @@ subtest 'store() tests' => sub { > 'No guarantors added' > ); > >- $relationship_1->relationship('father1')->store; >+ $relationship = ''; >+ >+ throws_ok >+ { $relationship_1->relationship($relationship)->store; } >+ 'Koha::Exceptions::Patron::Relationship::InvalidRelationship', >+ 'Exception is thrown as a wrong relationship was passed'; >+ >+ is( "$@", "Invalid relationship passed, '$relationship' is not defined.", 'Exception stringified correctly' ); >+ >+ is( Koha::Patron::Relationships->search( { guarantee_id => $patron_1->borrowernumber } )->count, >+ 0, >+ 'No guarantors added when empty relationship passed and not defined' >+ ); >+ >+ $relationship = 'father1'; >+ >+ $relationship_1->relationship($relationship)->store; > > is( Koha::Patron::Relationships->search( { guarantee_id => $patron_1->borrowernumber } )->count, > 1, >@@ -108,5 +124,17 @@ subtest 'store() tests' => sub { > ); > } > >+ t::lib::Mocks::mock_preference( 'borrowerRelationship', '' ); >+ >+ my $relationship_3 = Koha::Patron::Relationship->new( >+ { >+ guarantor_id => $patron_1->borrowernumber, >+ guarantee_id => $patron_2->borrowernumber, >+ relationship => '' >+ } >+ )->store(); >+ >+ is( $relationship_3->relationship, '', 'Empty relationship allowed' ); >+ > $schema->storage->txn_rollback; > }; >-- >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 25946
:
107469
|
108048
|
118991
|
118992
|
118993
|
118997
|
118998
|
118999
|
119011
|
119012
|
119013
| 119015