Bugzilla – Attachment 152148 Details for
Bug 33953
Add Koha::Biblio->ratings
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 33953: Adjust tests
Bug-33953-Adjust-tests.patch (text/plain), 2.80 KB, created by
Jonathan Druart
on 2023-06-08 10:55:53 UTC
(
hide
)
Description:
Bug 33953: Adjust tests
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2023-06-08 10:55:53 UTC
Size:
2.80 KB
patch
obsolete
>From 0526ca84264b00e26c2db155641c35f080452c75 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 8 Jun 2023 12:36:52 +0200 >Subject: [PATCH] Bug 33953: Adjust tests > >--- > t/db_dependent/Koha/Biblio.t | 8 +++++++- > t/db_dependent/Koha/Ratings.t | 9 ++++----- > 2 files changed, 11 insertions(+), 6 deletions(-) > >diff --git a/t/db_dependent/Koha/Biblio.t b/t/db_dependent/Koha/Biblio.t >index d676a79a319..d0945eb0666 100755 >--- a/t/db_dependent/Koha/Biblio.t >+++ b/t/db_dependent/Koha/Biblio.t >@@ -17,7 +17,7 @@ > > use Modern::Perl; > >-use Test::More tests => 25; >+use Test::More tests => 26; > use Test::Exception; > use Test::Warn; > >@@ -1126,6 +1126,12 @@ subtest 'normalized_isbn' => sub { > ); > }; > >+subtest 'ratings' => sub { >+ plan tests => 1; >+ # See t/db_dependent/Koha/Ratings.t >+ ok(1); >+}; >+ > sub component_record1 { > my $marc = MARC::Record->new; > $marc->append_fields( >diff --git a/t/db_dependent/Koha/Ratings.t b/t/db_dependent/Koha/Ratings.t >index faeed427202..664a48133f9 100755 >--- a/t/db_dependent/Koha/Ratings.t >+++ b/t/db_dependent/Koha/Ratings.t >@@ -37,11 +37,11 @@ my $biblionumber = $biblio_1->biblionumber; > my $rating_1 = Koha::Rating->new( { biblionumber => $biblionumber, borrowernumber => $patron_1->{borrowernumber}, rating_value => 3 } )->store; > my $rating_2 = Koha::Rating->new( { biblionumber => $biblionumber, borrowernumber => $patron_2->{borrowernumber}, rating_value => 4 } )->store; > >-is( Koha::Ratings->search( { biblionumber => $biblionumber } )->get_avg_rating, 3.5, 'get_avg_rating is 3.5' ); >+is( $biblio_1->ratings->get_avg_rating, 3.5, 'get_avg_rating is 3.5' ); > > $rating_1->rating_value(5)->store; > >-is( Koha::Ratings->search( { biblionumber => $biblionumber } )->get_avg_rating, 4.5, 'get_avg_rating now up to 4.5' ); >+is( $biblio_1->ratings->get_avg_rating, 4.5, 'get_avg_rating now up to 4.5' ); > > $rating_1->rating_value(42)->store; > is( Koha::Ratings->find( { biblionumber => $biblionumber, borrowernumber => $patron_1->{borrowernumber} } )->rating_value, >@@ -53,7 +53,6 @@ is( Koha::Ratings->find( { biblionumber => $biblionumber, borrowernumber => $pat > > Koha::Ratings->find( { biblionumber => $biblionumber, borrowernumber => $patron_1->{borrowernumber} } )->delete; > Koha::Ratings->find( { biblionumber => $biblionumber, borrowernumber => $patron_2->{borrowernumber} } )->delete; >-is( Koha::Ratings->search( { biblionumber => $biblionumber } )->count, 0, 'Delete should have deleted the ratings' ); >- >-is( int(Koha::Ratings->search( { biblionumber => $biblionumber } )->get_avg_rating), 0, 'get_avg_rating should return 0 if no rating exist' ); >+is( $biblio_1->ratings->count, 0, 'Delete should have deleted the ratings' ); > >+is( int($biblio_1->ratings->get_avg_rating), 0, 'get_avg_rating should return 0 if no rating exist' ); >-- >2.25.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 33953
:
152148
|
152149
|
152720
|
152721
|
153411
|
153412