Bugzilla – Attachment 150789 Details for
Bug 22440
Improve ILL page performance by moving to server side filtering
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 22440: (follow-up) Fix existing tests
Bug-22440-follow-up-Fix-existing-tests.patch (text/plain), 4.77 KB, created by
Tomás Cohen Arazi (tcohen)
on 2023-05-05 19:26:39 UTC
(
hide
)
Description:
Bug 22440: (follow-up) Fix existing tests
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2023-05-05 19:26:39 UTC
Size:
4.77 KB
patch
obsolete
>From 5af00a2816612274711de1e21e8cf98395073a4b Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Fri, 5 May 2023 16:22:20 -0300 >Subject: [PATCH] Bug 22440: (follow-up) Fix existing tests > >As we are introducing a FK for illrequests.biblio_id, TestBuilder is >generating a linked biblio, and so tests expecting undef are failing. > >This fixes it by explicitly setting biblio_id => undef on creating the >request. > >The patch also cleans the area a bit, removing a redundant and fragile >test as well. >--- > t/db_dependent/Illrequests.t | 82 ++++++++++++++++-------------------- > 1 file changed, 36 insertions(+), 46 deletions(-) > >diff --git a/t/db_dependent/Illrequests.t b/t/db_dependent/Illrequests.t >index 65c1bc6fa5d..8ee9da5ca03 100755 >--- a/t/db_dependent/Illrequests.t >+++ b/t/db_dependent/Illrequests.t >@@ -191,63 +191,53 @@ subtest 'store borrowernumber change also updates holds' => sub { > > subtest 'Working with related objects' => sub { > >- plan tests => 7; >+ plan tests => 6; > > $schema->storage->txn_begin; > >- Koha::Illrequests->search->delete; >- >- my $patron = $builder->build({ source => 'Borrower' }); >- my $illrq = $builder->build({ >- source => 'Illrequest', >- value => { borrowernumber => $patron->{borrowernumber} } >- }); >- my $illrq_obj = Koha::Illrequests->find($illrq->{illrequest_id}); >- >- isa_ok($illrq_obj->patron, 'Koha::Patron', >- "OK accessing related patron."); >+ my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); >+ my $illrq = $builder->build_object( >+ { class => 'Koha::Illrequests', >+ value => { borrowernumber => $patron->id, biblio_id => undef } >+ } >+ ); > >- $builder->build({ >- source => 'Illrequestattribute', >- value => { illrequest_id => $illrq_obj->illrequest_id, type => 'X' } >- }); >- $builder->build({ >- source => 'Illrequestattribute', >- value => { illrequest_id => $illrq_obj->illrequest_id, type => 'Y' } >- }); >- $builder->build({ >- source => 'Illrequestattribute', >- value => { illrequest_id => $illrq_obj->illrequest_id, type => 'Z' } >- }); >+ isa_ok( $illrq->patron, 'Koha::Patron', "OK accessing related patron." ); > >- is($illrq_obj->illrequestattributes->count, Koha::Illrequestattributes->search->count, >- "Fetching expected number of Illrequestattributes for our request."); >+ $builder->build( >+ { source => 'Illrequestattribute', >+ value => { illrequest_id => $illrq->illrequest_id, type => 'X' } >+ } >+ ); >+ $builder->build( >+ { source => 'Illrequestattribute', >+ value => { illrequest_id => $illrq->illrequest_id, type => 'Y' } >+ } >+ ); >+ $builder->build( >+ { source => 'Illrequestattribute', >+ value => { illrequest_id => $illrq->illrequest_id, type => 'Z' } >+ } >+ ); > >- my $illrq1 = $builder->build({ source => 'Illrequest' }); >- $builder->build({ >- source => 'Illrequestattribute', >- value => { illrequest_id => $illrq1->{illrequest_id}, type => 'X' } >- }); >+ my $rs = Koha::Illrequestattributes->search( { illrequest_id => $illrq->id } ); > >- is($illrq_obj->illrequestattributes->count + 1, Koha::Illrequestattributes->search->count, >- "Fetching expected number of Illrequestattributes for our request."); >+ is( $illrq->extended_attributes->count, >+ $rs->count, "Fetching expected number of Illrequestattributes for our request." ); > >- is($illrq_obj->biblio, undef, "->biblio returns undef if no biblio"); >- my $biblio = $builder->build_object({ class => 'Koha::Biblios' }); >- my $req_bib = $builder->build_object({ >- class => 'Koha::Illrequests', >- value => { >- biblio_id => $biblio->biblionumber >+ is( $illrq->biblio, undef, "->biblio returns undef if no biblio" ); >+ my $biblio = $builder->build_object( { class => 'Koha::Biblios' } ); >+ my $req_bib = $builder->build_object( >+ { class => 'Koha::Illrequests', >+ value => { biblio_id => $biblio->biblionumber } > } >- }); >- isa_ok($req_bib->biblio, 'Koha::Biblio', "OK accessing related biblio"); >+ ); >+ isa_ok( $req_bib->biblio, 'Koha::Biblio', "OK accessing related biblio" ); > >- $illrq_obj->delete; >- is(Koha::Illrequestattributes->search->count, 1, >- "Correct number of illrequestattributes after delete."); >+ $illrq->delete; >+ is( $rs->count, 0, "Correct number of illrequestattributes after delete." ); > >- isa_ok(Koha::Patrons->find($patron->{borrowernumber}), 'Koha::Patron', >- "Borrower was not deleted after illrq delete."); >+ isa_ok( Koha::Patrons->find( $patron->id ), 'Koha::Patron', "Borrower was not deleted after illrq delete." ); > > $schema->storage->txn_rollback; > }; >-- >2.40.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 22440
:
150715
|
150716
|
150717
|
150718
|
150719
|
150720
|
150721
|
150722
|
150723
|
150788
| 150789