Files
animethemes-server/tests/Feature/Http/Api/Wiki/Anime/YearIndexTest.php
T
paranarimasu 2e930b17ff feat: initial migration to Laravel 10 (#572)
* feat: initial migration to Laravel 10

* style: fix StyleCI findings
2023-04-18 16:22:36 -05:00

36 lines
777 B
PHP

<?php
declare(strict_types=1);
namespace Tests\Feature\Http\Api\Wiki\Anime;
use App\Models\Wiki\Anime;
use Illuminate\Foundation\Testing\WithFaker;
use Tests\TestCase;
/**
* Class YearIndexTest.
*/
class YearIndexTest extends TestCase
{
use WithFaker;
/**
* The Year Index Endpoint shall display a list of unique years of anime.
*
* @return void
*/
public function testDefault(): void
{
$anime = Anime::factory()
->count($this->faker->randomDigitNotNull())
->create();
$response = $this->get(route('api.animeyear.index'));
$response->assertJson(
$anime->unique(Anime::ATTRIBUTE_YEAR)->sortBy(Anime::ATTRIBUTE_YEAR)->pluck(Anime::ATTRIBUTE_YEAR)->all(),
);
}
}