jikan-rest/tests/Integration/GenreControllerTest.php

51 lines
1.2 KiB
PHP
Raw Permalink Normal View History

<?php /** @noinspection PhpIllegalPsrClassPathInspection */
2023-02-12 15:14:11 +00:00
namespace Tests\Integration;
use App\GenreAnime;
use App\GenreManga;
use App\Testing\ScoutFlush;
use App\Testing\SyntheticMongoDbTransaction;
use Tests\TestCase;
2019-05-13 08:53:07 +05:00
class GenreControllerTest extends TestCase
{
use SyntheticMongoDbTransaction;
use ScoutFlush;
2019-05-13 08:53:07 +05:00
public function testAnimeGenre()
{
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()
{
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()
{
$this->mockJikanParserWith404RespondingUpstream();
2021-01-14 06:35:56 +05:00
$this->get('/v4/genres')
2019-05-13 08:53:07 +05:00
->seeStatusCode(404);
}
}