Bugzilla – Attachment 140007 Details for
Bug 29697
Replace GetMarcBiblio occurrences with $biblio->metadata->record
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29697: (QA follow-up) Make tests less fragile
Bug-29697-QA-follow-up-Make-tests-less-fragile.patch (text/plain), 4.04 KB, created by
Tomás Cohen Arazi (tcohen)
on 2022-08-31 15:35:38 UTC
(
hide
)
Description:
Bug 29697: (QA follow-up) Make tests less fragile
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2022-08-31 15:35:38 UTC
Size:
4.04 KB
patch
obsolete
>From 73bde2cca346b911aafff2b0011b3f0acdf720ba Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Wed, 31 Aug 2022 12:31:46 -0300 >Subject: [PATCH] Bug 29697: (QA follow-up) Make tests less fragile > >This patch makes the tests less fragile to existing data. It does so by >making sure that when checking if the item would be hidden by >OpacHiddenItems and lost status, the item is not skipped, and thus the >notforloan value, as retrieved from the search engine is picked for the >notforloan_count calculation. > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > t/db_dependent/Search.t | 31 ++++++++++++++++++++----------- > 1 file changed, 20 insertions(+), 11 deletions(-) > >diff --git a/t/db_dependent/Search.t b/t/db_dependent/Search.t >index fc40bdde6d..5c34356ac8 100755 >--- a/t/db_dependent/Search.t >+++ b/t/db_dependent/Search.t >@@ -467,13 +467,17 @@ ok(MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[0],' > ($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,\%branches,\%itemtypes,$query_type,0); > is($results_hashref->{biblioserver}->{hits}, 2, "getRecords generated availability-limited search matched right number of records"); > >- @newresults = searchResults({'interface'=>'opac'}, $query_desc, $results_hashref->{'biblioserver'}->{'hits'}, 17, 0, 0, >- $results_hashref->{'biblioserver'}->{"RECORDS"}); >- my $allavailable = 'true'; >- foreach my $result (@newresults) { >- $allavailable = 'false' unless $result->{availablecount} > 0; >+ { >+ my $mock_items = Test::MockModule->new('Koha::Items'); >+ $mock_items->mock( 'count', 1 ); >+ @newresults = searchResults({'interface'=>'opac'}, $query_desc, $results_hashref->{'biblioserver'}->{'hits'}, 17, 0, 0, >+ $results_hashref->{'biblioserver'}->{"RECORDS"}); >+ my $allavailable = 'true'; >+ foreach my $result (@newresults) { >+ $allavailable = 'false' unless $result->{availablecount} > 0; >+ } >+ is ($allavailable, 'true', 'All records have at least one item available'); > } >- is ($allavailable, 'true', 'All records have at least one item available'); > > my $mocked_xslt = Test::MockModule->new('Koha::XSLT::Base'); > $mocked_xslt->mock( 'transform', sub { >@@ -751,11 +755,16 @@ ok(MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[0],' > ( undef, $results_hashref, $facets_loop ) = > getRecords('ti:marc the large record', '', [], [ 'biblioserver' ], '20', 0, \%branches, \%itemtypes, 'ccl', undef); > is($results_hashref->{biblioserver}->{hits}, 1, "Can do a search that retrieves an over-large bib record (bug 11096)"); >- @newresults = searchResults({'interface' =>'opac'}, $query_desc, $results_hashref->{'biblioserver'}->{'hits'}, 10, 0, 0, >- $results_hashref->{'biblioserver'}->{"RECORDS"}); >- is($newresults[0]->{title}, 'Marc the Large Record', 'Able to render the title for over-large bib record (bug 11096)'); >- is($newresults[0]->{biblionumber}, '300', 'Over-large bib record has the correct biblionumber (bug 11096)'); >- like($newresults[0]->{notes}, qr/This is large note #550/, 'Able to render the notes field for over-large bib record (bug 11096)'); >+ >+ { >+ my $mock_items = Test::MockModule->new('Koha::Items'); >+ $mock_items->mock( 'count', 1 ); >+ @newresults = searchResults({'interface' =>'opac'}, $query_desc, $results_hashref->{'biblioserver'}->{'hits'}, 10, 0, 0, >+ $results_hashref->{'biblioserver'}->{"RECORDS"}); >+ is($newresults[0]->{title}, 'Marc the Large Record', 'Able to render the title for over-large bib record (bug 11096)'); >+ is($newresults[0]->{biblionumber}, '300', 'Over-large bib record has the correct biblionumber (bug 11096)'); >+ like($newresults[0]->{notes}, qr/This is large note #550/, 'Able to render the notes field for over-large bib record (bug 11096)'); >+ } > > # notforloancount should be returned as part of searchResults output > ok( defined $newresults[0]->{notforloancount}, >-- >2.34.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 29697
:
129757
|
129758
|
129759
|
129760
|
129761
|
131868
|
131869
|
131870
|
131871
|
131872
|
131873
|
134066
|
134067
|
134068
|
134069
|
134070
|
134071
|
135574
|
135575
|
135576
|
135577
|
135578
|
135579
|
135580
|
135662
|
135663
|
135664
|
135665
|
135666
|
135667
|
135668
|
135669
|
135670
|
135671
|
135672
|
135673
|
135797
|
135798
|
135799
|
135800
|
135801
|
135802
|
135978
|
135979
|
135980
|
135981
|
135982
|
137835
|
137836
|
137837
|
137838
|
137839
|
137840
|
137894
|
137918
|
137919
|
137920
|
137921
|
137922
|
137923
|
137924
|
137948
|
138057
|
138076
|
138077
|
138078
|
138079
|
138080
|
138081
|
138089
|
138090
|
138804
|
139127
| 140007 |
140008