mirror of
https://github.com/jikan-me/jikan-rest.git
synced 2025-02-20 11:23:35 +08:00
fixed tests according to the recent factory changes
This commit is contained in:
parent
9de8ffc9db
commit
9342407bef
@ -62,6 +62,8 @@ abstract class JikanMediaModelFactory extends JikanModelFactory implements Media
|
||||
return $this->state($this->serializeStateDefinition($this->getStateOverrides($additionalParams, $doOpposite)));
|
||||
}
|
||||
|
||||
// we want to generate overrides for each manufactured item, so all of them will call the faker for values,
|
||||
// and they should have their own values, increasing the randomness of the generated data
|
||||
/** @noinspection PhpParamsInspection */
|
||||
return $this->state(new Sequence(fn(Sequence $_) => $this->serializeStateDefinition($this->getStateOverrides($additionalParams, $doOpposite))));
|
||||
}
|
||||
|
@ -261,16 +261,16 @@ class AnimeSearchEndpointTest extends TestCase
|
||||
*/
|
||||
public function testSearchByEndDate($params)
|
||||
{
|
||||
$overrides = $this->generateFiveSpecificAndTenRandomElementsInDb($params);
|
||||
$this->generateFiveSpecificAndTenRandomElementsInDb($params);
|
||||
|
||||
$content = $this->getJsonResponse($params);
|
||||
|
||||
$actualEndDate = Carbon::parse(data_get($content, "data.0.aired.to"));
|
||||
$paramEndDate = Carbon::parse($overrides["aired"]["to"]);
|
||||
$paramEndDate = Carbon::parse($params['end_date']);
|
||||
|
||||
$this->seeStatusCode(200);
|
||||
$this->assertPaginationData(5);
|
||||
$this->assertLessThanOrEqual(0, $actualEndDate->diff($paramEndDate)->days);
|
||||
$this->assertGreaterThanOrEqual(1, $actualEndDate->diff($paramEndDate)->days);
|
||||
// we created 5 elements according to parameters, so we expect 5 of them.
|
||||
$this->assertCount(5, $content["data"]);
|
||||
}
|
||||
|
@ -243,16 +243,16 @@ class MangaSearchEndpointTest extends TestCase
|
||||
*/
|
||||
public function testSearchByEndDate($params)
|
||||
{
|
||||
$overrides = $this->generateFiveSpecificAndTenRandomElementsInDb($params);
|
||||
$this->generateFiveSpecificAndTenRandomElementsInDb($params);
|
||||
|
||||
$content = $this->getJsonResponse($params);
|
||||
|
||||
$actualEndDate = Carbon::parse(data_get($content, "data.0.published.to"));
|
||||
$paramEndDate = Carbon::parse($overrides["published"]["to"]);
|
||||
$paramEndDate = Carbon::parse($params["end_date"]);
|
||||
|
||||
$this->seeStatusCode(200);
|
||||
$this->assertPaginationData(5);
|
||||
$this->assertLessThanOrEqual(0, $actualEndDate->diff($paramEndDate)->days);
|
||||
$this->assertGreaterThanOrEqual(1, $actualEndDate->diff($paramEndDate)->days);
|
||||
// we created 5 elements according to parameters, so we expect 5 of them.
|
||||
$this->assertCount(5, $content["data"]);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user