Bugzilla – Attachment 91823 Details for
Bug 1985
Email notification of new OPAC comments
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 1985: (follow-up) Fix Reviews.t logic
Bug-1985-follow-up-Fix-Reviewst-logic.patch (text/plain), 2.93 KB, created by
ByWater Sandboxes
on 2019-07-26 15:41:31 UTC
(
hide
)
Description:
Bug 1985: (follow-up) Fix Reviews.t logic
Filename:
MIME Type:
Creator:
ByWater Sandboxes
Created:
2019-07-26 15:41:31 UTC
Size:
2.93 KB
patch
obsolete
>From 0f26e9a0705e43e5d0754252d85d29c6250415e8 Mon Sep 17 00:00:00 2001 >From: Mark Tompsett <mtompset@hotmail.com> >Date: Wed, 3 Jul 2019 00:11:56 +0000 >Subject: [PATCH] Bug 1985: (follow-up) Fix Reviews.t logic > >Read the tests to make sure they make sense. >Before the patch is applied, they don't. > >$nb_of_approved_reviews + 2 did not make sense, because the three >reviews added were not approved. >search->count counts everything, so the use of approved+3 didn't >make sense. >Rather than duplicate the search->count test, changed the >first one to reflect that the added reviews were all unapproved. > >Before applying patch, prove fails. > >After applying patch, prove passes. > >Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> >--- > t/db_dependent/Koha/Reviews.t | 9 ++++++--- > 1 file changed, 6 insertions(+), 3 deletions(-) > >diff --git a/t/db_dependent/Koha/Reviews.t b/t/db_dependent/Koha/Reviews.t >index 6dd859498b..edf03a52bb 100644 >--- a/t/db_dependent/Koha/Reviews.t >+++ b/t/db_dependent/Koha/Reviews.t >@@ -43,6 +43,7 @@ my $biblio_1 = $builder->build({ source => 'Biblio' }); > my $biblio_2 = $builder->build({ source => 'Biblio' }); > my $nb_of_messages = Koha::Notice::Messages->search->count; > my $nb_of_reviews = Koha::Reviews->search->count; >+my $nb_of_unapproved_reviews = Koha::Reviews->search({ approved => 0 })->count; > my $nb_of_approved_reviews = Koha::Reviews->search({ approved => 1 })->count; > my $new_review_1_1 = Koha::Review->new({ > borrowernumber => $patron_1->borrowernumber, >@@ -61,7 +62,8 @@ my $new_review_2_1 = Koha::Review->new({ > })->store; > > like( $new_review_1_1->reviewid, qr|^\d+$|, 'Adding a new review should have set the reviewid'); >-is( Koha::Reviews->search->count, $nb_of_reviews + 3, 'The 3 reviews should have been added' ); >+is( Koha::Reviews->search({ approved => 0 })->count, $nb_of_unapproved_reviews + 3, >+ 'The 3 unapproved reviews should have been added' ); > > is( Koha::Reviews->search({approved => 1})->count, $nb_of_approved_reviews, 'There should not be new approved reviews' ); > $new_review_1_1->approve; >@@ -80,8 +82,9 @@ subtest 'search_limited' => sub { > Koha::Library::Group->new({ parent_id => $group_1->id, branchcode => $patron_1->branchcode })->store(); > Koha::Library::Group->new({ parent_id => $group_2->id, branchcode => $patron_2->branchcode })->store(); > t::lib::Mocks::mock_userenv( { patron => $patron_1 } ); >- is( Koha::Reviews->search->count, $nb_of_approved_reviews + 3, 'Koha::Reviews->search should return all reviews' ); >- is( Koha::Reviews->search_limited->count, $nb_of_approved_reviews + 2, 'Koha::Reviews->search_limited should return reviews depending on patron permissions' ); >+ is( Koha::Reviews->search->count, $nb_of_reviews + 3, 'Koha::Reviews->search should return all reviews' ); >+ is( Koha::Reviews->search_limited->count, 2, >+ 'Koha::Reviews->search_limited should return reviews depending on patron permissions' ); > }; > > $retrieved_review_1_1->delete; >-- >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 1985
:
33916
|
33918
|
36065
|
36516
|
36517
|
36521
|
36522
|
36613
|
36614
|
36628
|
36629
|
36643
|
36644
|
36645
|
36677
|
36678
|
36720
|
38908
|
38909
|
38910
|
39062
|
63746
|
63747
|
63748
|
63749
|
63750
|
63751
|
63752
|
63761
|
63762
|
63763
|
74760
|
74761
|
74762
|
74763
|
74764
|
74769
|
74770
|
74771
|
91190
|
91191
|
91192
|
91193
|
91194
|
91195
|
91196
|
91197
|
91198
|
91818
|
91819
|
91820
|
91821
|
91822
| 91823