@@ -148,7 +148,7 @@ public function test_getReceivedReview_can_retrieve_unapproved_review_when_inclu
148
148
$ this ->assertEquals (3 , $ review ->rating );
149
149
}
150
150
151
- public function test_latestReceivedReviews_retrieves_latest_approved_reviews_by_default ()
151
+ public function test_latestReceivedReviews_retrieves_latest_approved_reviews ()
152
152
{
153
153
$ newMentee = Mentor::factory ()->create ();
154
154
@@ -160,28 +160,16 @@ public function test_latestReceivedReviews_retrieves_latest_approved_reviews_by_
160
160
$ this ->assertEquals ($ reviews ->first ()->id , $ newReview ->id );
161
161
}
162
162
163
- public function test_latestReceivedReviews_not_returning_unapproved_reviews_by_default ()
163
+ public function test_topRatedReceivedReviews_retrieves_top_rated_approved_reviews ()
164
164
{
165
165
$ newMentee = Mentor::factory ()->create ();
166
166
167
- $ newReview = $ newMentee ->review ($ this ->mentor , 4 , ' nice!!! ' , isApproved: false );
167
+ $ newMentee ->review ($ this ->mentor , 2 );
168
168
169
- $ reviews = $ this ->mentor ->latestReceivedReviews ()->get ();
170
-
171
- $ this ->assertCount (2 , $ reviews );
172
- $ this ->assertNotEquals ($ reviews ->first ()->id , $ newReview ->id );
173
- }
174
-
175
- public function test_latestReceivedReviews_can_retrieves_unapproved_reviews_when_includeUnapproved_is_true ()
176
- {
177
- $ newMentee = Mentor::factory ()->create ();
178
-
179
- $ newReview = $ newMentee ->review ($ this ->mentor , 4 , 'nice!!! ' , isApproved: false );
180
-
181
- $ reviews = $ this ->mentor ->latestReceivedReviews (includeUnapproved: true )->get ();
169
+ $ reviews = $ this ->mentor ->topRatedReceivedReviews ()->get ();
182
170
183
171
$ this ->assertCount (3 , $ reviews );
184
- $ this ->assertEquals ($ reviews ->first ()->id , $ newReview -> id );
172
+ $ this ->assertEquals ($ reviews ->first ()->rating , 5 );
185
173
}
186
174
187
175
public function test_a_reviewable_can_display_its_review_summary ()
0 commit comments