2022-12-11 00:08:59 +00:00
|
|
|
<?php /** @noinspection PhpIllegalPsrClassPathInspection */
|
2023-02-12 15:14:11 +00:00
|
|
|
namespace Tests\Integration;
|
2023-02-05 00:55:11 +00:00
|
|
|
use App\GenreAnime;
|
|
|
|
use App\GenreManga;
|
2023-02-02 23:37:37 +00:00
|
|
|
use App\Testing\ScoutFlush;
|
|
|
|
use App\Testing\SyntheticMongoDbTransaction;
|
2022-12-11 00:08:59 +00:00
|
|
|
use Tests\TestCase;
|
2019-05-13 08:53:07 +05:00
|
|
|
|
|
|
|
class GenreControllerTest extends TestCase
|
|
|
|
{
|
2023-02-02 23:37:37 +00:00
|
|
|
use SyntheticMongoDbTransaction;
|
|
|
|
use ScoutFlush;
|
|
|
|
|
2019-05-13 08:53:07 +05:00
|
|
|
public function testAnimeGenre()
|
|
|
|
{
|
2023-02-05 00:55:11 +00:00
|
|
|
GenreAnime::factory()->createOne();
|
2021-01-14 06:35:56 +05:00
|
|
|
$this->get('/v4/genres/anime')
|
2019-05-13 08:53:07 +05:00
|
|
|
->seeStatusCode(200)
|
2021-01-14 06:35:56 +05:00
|
|
|
->seeJsonStructure(['data'=>[
|
|
|
|
[
|
2019-05-13 08:53:07 +05:00
|
|
|
'mal_id',
|
|
|
|
'name',
|
2021-01-14 06:35:56 +05:00
|
|
|
'url',
|
|
|
|
'count'
|
2019-05-13 08:53:07 +05:00
|
|
|
]
|
2021-01-14 06:35:56 +05:00
|
|
|
]]);
|
2019-05-13 08:53:07 +05:00
|
|
|
}
|
|
|
|
|
|
|
|
public function testMangaGenre()
|
|
|
|
{
|
2023-02-05 00:55:11 +00:00
|
|
|
GenreManga::factory()->createOne();
|
2021-01-14 06:35:56 +05:00
|
|
|
$this->get('/v4/genres/manga')
|
2019-05-13 08:53:07 +05:00
|
|
|
->seeStatusCode(200)
|
2021-01-14 06:35:56 +05:00
|
|
|
->seeJsonStructure(['data'=>[
|
|
|
|
[
|
2019-05-13 08:53:07 +05:00
|
|
|
'mal_id',
|
|
|
|
'name',
|
2021-01-14 06:35:56 +05:00
|
|
|
'url',
|
|
|
|
'count'
|
2019-05-13 08:53:07 +05:00
|
|
|
]
|
2021-01-14 06:35:56 +05:00
|
|
|
]]);
|
2019-05-13 08:53:07 +05:00
|
|
|
}
|
|
|
|
|
|
|
|
public function test404()
|
|
|
|
{
|
2023-02-02 23:37:37 +00:00
|
|
|
$this->mockJikanParserWith404RespondingUpstream();
|
2021-01-14 06:35:56 +05:00
|
|
|
$this->get('/v4/genres')
|
2019-05-13 08:53:07 +05:00
|
|
|
->seeStatusCode(404);
|
|
|
|
}
|
|
|
|
}
|