View | Details | Raw Unified | Return to bug 1985
Collapse All | Expand All

(-)a/t/db_dependent/Koha/Reviews.t (-4 / +6 lines)
Lines 43-48 my $biblio_1 = $builder->build({ source => 'Biblio' }); Link Here
43
my $biblio_2 = $builder->build({ source => 'Biblio' });
43
my $biblio_2 = $builder->build({ source => 'Biblio' });
44
my $nb_of_messages = Koha::Notice::Messages->search->count;
44
my $nb_of_messages = Koha::Notice::Messages->search->count;
45
my $nb_of_reviews = Koha::Reviews->search->count;
45
my $nb_of_reviews = Koha::Reviews->search->count;
46
my $nb_of_unapproved_reviews = Koha::Reviews->search({ approved => 0 })->count;
46
my $nb_of_approved_reviews = Koha::Reviews->search({ approved => 1 })->count;
47
my $nb_of_approved_reviews = Koha::Reviews->search({ approved => 1 })->count;
47
my $new_review_1_1 = Koha::Review->new({
48
my $new_review_1_1 = Koha::Review->new({
48
    borrowernumber => $patron_1->borrowernumber,
49
    borrowernumber => $patron_1->borrowernumber,
Lines 61-67 my $new_review_2_1 = Koha::Review->new({ Link Here
61
})->store;
62
})->store;
62
63
63
like( $new_review_1_1->reviewid, qr|^\d+$|, 'Adding a new review should have set the reviewid');
64
like( $new_review_1_1->reviewid, qr|^\d+$|, 'Adding a new review should have set the reviewid');
64
is( Koha::Reviews->search->count, $nb_of_reviews + 3, 'The 3 reviews should have been added' );
65
is( Koha::Reviews->search({ approved => 0 })->count, $nb_of_unapproved_reviews + 3,
66
    'The 3 unapproved reviews should have been added' );
65
67
66
is( Koha::Reviews->search({approved => 1})->count, $nb_of_approved_reviews, 'There should not be new approved reviews' );
68
is( Koha::Reviews->search({approved => 1})->count, $nb_of_approved_reviews, 'There should not be new approved reviews' );
67
$new_review_1_1->approve;
69
$new_review_1_1->approve;
Lines 80-87 subtest 'search_limited' => sub { Link Here
80
    Koha::Library::Group->new({ parent_id => $group_1->id,  branchcode => $patron_1->branchcode })->store();
82
    Koha::Library::Group->new({ parent_id => $group_1->id,  branchcode => $patron_1->branchcode })->store();
81
    Koha::Library::Group->new({ parent_id => $group_2->id,  branchcode => $patron_2->branchcode })->store();
83
    Koha::Library::Group->new({ parent_id => $group_2->id,  branchcode => $patron_2->branchcode })->store();
82
    t::lib::Mocks::mock_userenv( { patron => $patron_1 } );
84
    t::lib::Mocks::mock_userenv( { patron => $patron_1 } );
83
    is( Koha::Reviews->search->count, $nb_of_approved_reviews + 3, 'Koha::Reviews->search should return all reviews' );
85
    is( Koha::Reviews->search->count, $nb_of_reviews + 3, 'Koha::Reviews->search should return all reviews' );
84
    is( Koha::Reviews->search_limited->count, $nb_of_approved_reviews + 2, 'Koha::Reviews->search_limited should return reviews depending on patron permissions' );
86
    is( Koha::Reviews->search_limited->count, 2,
87
        'Koha::Reviews->search_limited should return reviews depending on patron permissions' );
85
};
88
};
86
89
87
$retrieved_review_1_1->delete;
90
$retrieved_review_1_1->delete;
88
- 

Return to bug 1985