mirror of
https://github.com/jikan-me/jikan-rest.git
synced 2025-02-20 11:23:35 +08:00
fixed orderBy parameter tests
This commit is contained in:
parent
716d8ea8e7
commit
fcea126272
@ -145,9 +145,9 @@ class AnimeFactory extends JikanModelFactory
|
||||
return fn($i) => $randomDate->copy()->addDays($i);
|
||||
})()),
|
||||
"rating" => ((function() {
|
||||
$validRatingNumbers = array_map(fn($el) => floatval($el), range(1, 9));
|
||||
$validRatingNumbersCount = count($validRatingNumbers);
|
||||
return fn($i) => $validRatingNumbers[$i % $validRatingNumbersCount];
|
||||
$validRatingItems = array_values(AnimeSearchQueryBuilder::MAP_RATING);
|
||||
$validRatingItemsCount = count($validRatingItems);
|
||||
return fn($i) => $validRatingItems[$i % $validRatingItemsCount];
|
||||
})()),
|
||||
"title" => ((function() {
|
||||
$alphabet = range("a", "z");
|
||||
|
@ -368,7 +368,7 @@ class AnimeSearchEndpointTest extends TestCase
|
||||
/**
|
||||
* @dataProvider orderByFieldMappingProvider
|
||||
*/
|
||||
public function testOrdering(string $paramName, string $orderByField)
|
||||
public function testOrderByQueryStringParameter(string $paramName, string $orderByField)
|
||||
{
|
||||
$expectedCount = 3;
|
||||
$f = Anime::factory($expectedCount);
|
||||
@ -377,7 +377,7 @@ class AnimeSearchEndpointTest extends TestCase
|
||||
*/
|
||||
$items = $f->createManyWithOrder($orderByField);
|
||||
$content = $this->getJsonResponse([
|
||||
"orderBy" => $paramName
|
||||
"order_by" => $paramName
|
||||
]);
|
||||
|
||||
$this->seeStatusCode(200);
|
||||
@ -393,6 +393,7 @@ class AnimeSearchEndpointTest extends TestCase
|
||||
}
|
||||
|
||||
$this->assertEquals(0, $expectedItems->diff($actualItems)->count());
|
||||
$this->assertTrue($expectedItems->toArray() === $actualItems->toArray());
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user