Bugzilla – Attachment 100263 Details for
Bug 23112
Add circulation process to inter-library loans
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23112: (QA follow-up) Clean up tests, catch warnings
Bug-23112-QA-follow-up-Clean-up-tests-catch-warnin.patch (text/plain), 4.73 KB, created by
Nick Clemens (kidclamp)
on 2020-03-06 11:37:47 UTC
(
hide
)
Description:
Bug 23112: (QA follow-up) Clean up tests, catch warnings
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2020-03-06 11:37:47 UTC
Size:
4.73 KB
patch
obsolete
>From 9b9c9acac65a66f84b64de58f03ca75dd83078ea Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Fri, 6 Mar 2020 11:35:05 +0000 >Subject: [PATCH] Bug 23112: (QA follow-up) Clean up tests, catch warnings > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >--- > t/db_dependent/Illrequests.t | 65 ++++++++++++++++++-------------------------- > 1 file changed, 27 insertions(+), 38 deletions(-) > >diff --git a/t/db_dependent/Illrequests.t b/t/db_dependent/Illrequests.t >index 41b4bf7600..15cb844276 100644 >--- a/t/db_dependent/Illrequests.t >+++ b/t/db_dependent/Illrequests.t >@@ -34,6 +34,8 @@ use Test::MockObject; > use Test::MockModule; > use Test::Exception; > use Test::Deep qw/ cmp_deeply ignore /; >+use Test::Warn; >+use Carp::Always; > > use Test::More tests => 12; > >@@ -810,7 +812,7 @@ subtest 'Censorship' => sub { > > subtest 'Checking out' => sub { > >- plan tests => 16; >+ plan tests => 17; > > $schema->storage->txn_begin; > >@@ -821,7 +823,7 @@ subtest 'Checking out' => sub { > } > }); > my $library = $builder->build_object({ class => 'Koha::Libraries' }); >- my $biblio = $builder->build_object({ class => 'Koha::Biblios' }); >+ my $biblio = $builder->build_sample_biblio(); > my $patron = $builder->build_object({ > class => 'Koha::Patrons', > value => { category_type => 'x' } >@@ -864,20 +866,8 @@ subtest 'Checking out' => sub { > inhouse => 1 > }); > # Too many items attached to biblio >- my $item1 = $builder->build_object({ >- class => 'Koha::Items', >- value => { >- biblionumber => $biblio->biblionumber, >- biblioitemnumber => 1 >- } >- }); >- my $item2 = $builder->build_object({ >- class => 'Koha::Items', >- value => { >- biblionumber => $biblio->biblionumber, >- biblioitemnumber => 2 >- } >- }); >+ my $item1 = $builder->build_sample_item({ biblionumber => $biblio->biblionumber }); >+ my $item2 = $builder->build_sample_item({ biblionumber => $biblio->biblionumber }); > my $form_stage_two_items = $request->check_out({ > stage => 'form', > item_type => $itemtype->itemtype, >@@ -886,32 +876,30 @@ subtest 'Checking out' => sub { > itemcount => 1 > }); > >- # Passed validation >- # >+ # Delete the items we created, so we can test that we can create one >+ $item1->delete; >+ $item2->delete; >+ > # We need to mock the user environment for AddIssue >- t::lib::Mocks::mock_userenv({ branchcode => $library->{branchcode} }); >+ t::lib::Mocks::mock_userenv({ branchcode => $library->branchcode }); > # >- # Delete the items we created, so we can test that we can create one >- Koha::Items->find({ itemnumber => $item1->itemnumber })->delete; >- Koha::Items->find({ itemnumber => $item2->itemnumber })->delete; >- # Create a biblioitem >- my $biblioitem = $builder->build_object({ >- class => 'Koha::Biblioitems', >- value => { >- biblionumber => $biblio->biblionumber >- } >- }); >+ > # First we pass bad parameters to the item creation to test we're > # catching the failure of item creation >- # Note: This will generate a DBD::mysql error when running this test! >- my $form_stage_bad_branchcode = $request->check_out({ >- stage => 'form', >- item_type => $itemtype->itemtype, >- branchcode => '---' >- }); >+ my $form_stage_bad_branchcode; >+ warning_like { >+ $form_stage_bad_branchcode = $request->check_out({ >+ stage => 'form', >+ item_type => $itemtype->itemtype, >+ branchcode => '---' >+ }); >+ } qr/^DBD::mysql::st execute failed: Cannot add or update a child row: a foreign key constraint fails/, >+ "Item creation fails on bad parameters"; >+ > is_deeply($form_stage_bad_branchcode->{value}->{errors}, { > item_creation => 1 >- }); >+ },"We get expected failure of item creation"); >+ > # Now create a proper item > my $form_stage_good_branchcode = $request->check_out({ > stage => 'form', >@@ -927,7 +915,8 @@ subtest 'Checking out' => sub { > NOT_FOR_LOAN => 1, > itemtype_notforloan => $itemtype->itemtype > } >- } >+ }, >+ "We get expected error on notforloan of item" > ); > # Delete the item that was created > $biblio->items->delete; >@@ -939,7 +928,7 @@ subtest 'Checking out' => sub { > } > }); > # We need to mock the user environment for AddIssue >- t::lib::Mocks::mock_userenv({ branchcode => $library->{branchcode} }); >+ t::lib::Mocks::mock_userenv({ branchcode => $library->branchcode }); > my $form_stage_loanable = $request->check_out({ > stage => 'form', > item_type => $itemtype_loanable->itemtype, >-- >2.11.0
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 23112
:
91987
|
91988
|
91989
|
91990
|
91991
|
92000
|
92001
|
92002
|
92003
|
92004
|
93530
|
93531
|
93532
|
93533
|
93534
|
93958
|
94264
|
94265
|
94266
|
94267
|
94268
|
94269
|
95565
|
95566
|
95567
|
95568
|
95569
|
95570
|
96834
|
96870
|
99910
|
99911
|
99912
|
99913
|
99914
|
99915
|
99916
|
99917
|
100100
|
100101
|
100102
|
100103
|
100104
|
100105
|
100106
|
100107
|
100108
|
100169
|
100224
|
100225
|
100252
|
100253
|
100254
|
100255
|
100256
|
100257
|
100258
|
100259
|
100260
|
100261
|
100262
| 100263