Mason James
7eef4c8c70
patch applied to commit eb3dc448d2
Signed-off-by: Nicole C. Engard <nengard@bywatersolutions.com>
Turned on star ratings in the opac on details and results
Searched for titles - saw the stars
Clicked on a title
Clicked on the stars
Clicked on the stars to change my rating
Logged out
Tried to click on stars
Logged in as different user
Rated items that were rated already and saw average change
Changed preference to show only on detail and repeated tests
Changed preference to now show stars
All above tests passed. Signing off.
Rebased 3-19-12 by Ian Walls
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
63 lines
2 KiB
Perl
Executable file
63 lines
2 KiB
Perl
Executable file
#!/usr/bin/perl
|
|
|
|
use strict;
|
|
use warnings;
|
|
use Test::More tests => 12;
|
|
use C4::Members;
|
|
|
|
BEGIN {
|
|
|
|
use FindBin;
|
|
use C4::Ratings;
|
|
use_ok('C4::Ratings');
|
|
|
|
DelRating( 1, 901 );
|
|
DelRating( 1, 902 );
|
|
|
|
my $rating5 = GetRating( 1, undef );
|
|
ok( defined $rating5, 'get a rating, without borrowernumber' );
|
|
|
|
my $borrower102 = GetMember( borrowernumber => 102);
|
|
my $borrower103 = GetMember( borrowernumber => 103);
|
|
SKIP: {
|
|
skip 'Missing test borrowers, skipping specific tests', 10 unless ( defined $borrower102 && defined $borrower103 );
|
|
my $rating1 = AddRating( 1, 102, 3 );
|
|
my $rating2 = AddRating( 1, 103, 4 );
|
|
my $rating3 = ModRating( 1, 102, 5 );
|
|
my $rating4 = GetRating( 1, 103 );
|
|
my $rating6 = DelRating( 1, 102 );
|
|
my $rating7 = DelRating( 1, 103 );
|
|
|
|
ok( defined $rating1, 'add a rating' );
|
|
ok( defined $rating2, 'add another rating' );
|
|
ok( defined $rating3, 'update a rating' );
|
|
ok( defined $rating4, 'get a rating, with borrowernumber' );
|
|
ok( defined $rating6, 'delete a rating' );
|
|
ok( defined $rating7, 'delete another rating' );
|
|
|
|
ok( $rating3->{'rating_avg'} == '4', "get a bib's average(float) rating" );
|
|
ok( $rating3->{'rating_avg_int'} == 4.5, "get a bib's average(int) rating" );
|
|
ok( $rating3->{'rating_total'} == 2, "get a bib's total number of ratings" );
|
|
ok( $rating3->{'rating_value'} == 5, "verify user's bib rating" );
|
|
}
|
|
|
|
}
|
|
|
|
=c
|
|
|
|
mason@xen1:~/g/head$ perl t/db_dependent/Ratings.t
|
|
1..12
|
|
ok 1 - use C4::Ratings;
|
|
ok 2 - add a rating
|
|
ok 3 - add another rating
|
|
ok 4 - update a rating
|
|
ok 5 - get a rating, with borrowernumber
|
|
ok 6 - get a rating, without borrowernumber
|
|
ok 7 - get a bib's average(float) rating
|
|
ok 8 - get a bib's average(int) rating
|
|
ok 9 - get a bib's total number of ratings
|
|
ok 10 - verify user's bib rating
|
|
ok 11 - delete a rating
|
|
ok 12 - delete another rating
|
|
|
|
=cut
|