Version 5.1 - All the GraphQL #32
@ -47,19 +47,15 @@ class MangaListTransformerTest extends AnimeClientTestCase {
|
||||
}
|
||||
|
||||
$this->beforeTransform = $rawBefore['data'];
|
||||
$this->afterTransform = Json::decodeFile("{$this->dir}/mangaListAfterTransform.json");
|
||||
// $this->afterTransform = Json::decodeFile("{$this->dir}/mangaListAfterTransform.json");
|
||||
|
||||
$this->transformer = new MangaListTransformer();
|
||||
}
|
||||
|
||||
public function testTransform()
|
||||
{
|
||||
$expected = $this->afterTransform;
|
||||
$actual = $this->transformer->transformCollection($this->beforeTransform);
|
||||
|
||||
// Json::encodeFile("{$this->dir}/mangaListAfterTransform.json", $actual);
|
||||
|
||||
$this->assertEquals($expected, $actual);
|
||||
$this->assertMatchesSnapshot($actual);
|
||||
}
|
||||
|
||||
public function testUntransform()
|
||||
@ -69,6 +65,7 @@ class MangaListTransformerTest extends AnimeClientTestCase {
|
||||
'mal_id' => '26769',
|
||||
'chapters_read' => 67,
|
||||
'manga' => [
|
||||
'id' => '12345',
|
||||
'titles' => ["Bokura wa Minna Kawaisou"],
|
||||
'alternate_title' => NULL,
|
||||
'slug' => "bokura-wa-minna-kawaisou",
|
||||
|
@ -36,8 +36,8 @@ class MangaTransformerTest extends AnimeClientTestCase {
|
||||
$data = Json::decodeFile("{$this->dir}/mangaBeforeTransform.json");
|
||||
$baseData = $data['data'][0]['attributes'];
|
||||
$baseData['included'] = $data['included'];
|
||||
$baseData['id'] = $data['data'][0]['id'];
|
||||
$this->beforeTransform = $baseData;
|
||||
$this->afterTransform = Json::decodeFile("{$this->dir}/mangaAfterTransform.json");
|
||||
|
||||
$this->transformer = new MangaTransformer();
|
||||
}
|
||||
@ -45,9 +45,6 @@ class MangaTransformerTest extends AnimeClientTestCase {
|
||||
public function testTransform()
|
||||
{
|
||||
$actual = $this->transformer->transform($this->beforeTransform);
|
||||
$expected = $this->afterTransform;
|
||||
//Json::encodeFile("{$this->dir}/mangaAfterTransform.json", $actual);
|
||||
|
||||
$this->assertEquals($expected, $actual);
|
||||
$this->assertMatchesSnapshot($actual);
|
||||
}
|
||||
}
|
@ -0,0 +1,206 @@
|
||||
<?php return array (
|
||||
0 =>
|
||||
array (
|
||||
'id' => '15084773',
|
||||
'mal_id' => '26769',
|
||||
'chapters' =>
|
||||
array (
|
||||
'read' => 67,
|
||||
'total' => '-',
|
||||
),
|
||||
'volumes' =>
|
||||
array (
|
||||
'read' => '-',
|
||||
'total' => '-',
|
||||
),
|
||||
'manga' =>
|
||||
array (
|
||||
'id' => '20286',
|
||||
'titles' =>
|
||||
array (
|
||||
0 => 'Bokura wa Minna Kawaisou',
|
||||
),
|
||||
'alternate_title' => NULL,
|
||||
'slug' => 'bokura-wa-minna-kawaisou',
|
||||
'url' => 'https://kitsu.io/manga/bokura-wa-minna-kawaisou',
|
||||
'type' => 'manga',
|
||||
'image' => 'https://media.kitsu.io/manga/poster_images/20286/small.jpg?1434293999',
|
||||
'genres' =>
|
||||
array (
|
||||
0 => 'Comedy',
|
||||
1 => 'Romance',
|
||||
2 => 'School',
|
||||
3 => 'Slice of Life',
|
||||
4 => 'Thriller',
|
||||
),
|
||||
),
|
||||
'reading_status' => 'current',
|
||||
'notes' => '',
|
||||
'rereading' => false,
|
||||
'reread' => 0,
|
||||
'user_rating' => 9.0,
|
||||
),
|
||||
1 =>
|
||||
array (
|
||||
'id' => '15085607',
|
||||
'mal_id' => '16',
|
||||
'chapters' =>
|
||||
array (
|
||||
'read' => 17,
|
||||
'total' => 120,
|
||||
),
|
||||
'volumes' =>
|
||||
array (
|
||||
'read' => '-',
|
||||
'total' => 14,
|
||||
),
|
||||
'manga' =>
|
||||
array (
|
||||
'id' => '47',
|
||||
'titles' =>
|
||||
array (
|
||||
0 => 'Love Hina',
|
||||
),
|
||||
'alternate_title' => NULL,
|
||||
'slug' => 'love-hina',
|
||||
'url' => 'https://kitsu.io/manga/love-hina',
|
||||
'type' => 'manga',
|
||||
'image' => 'https://media.kitsu.io/manga/poster_images/47/small.jpg?1434249493',
|
||||
'genres' =>
|
||||
array (
|
||||
0 => 'Comedy',
|
||||
1 => 'Ecchi',
|
||||
2 => 'Harem',
|
||||
3 => 'Romance',
|
||||
4 => 'Sports',
|
||||
),
|
||||
),
|
||||
'reading_status' => 'current',
|
||||
'notes' => '',
|
||||
'rereading' => false,
|
||||
'reread' => 0,
|
||||
'user_rating' => 7.0,
|
||||
),
|
||||
2 =>
|
||||
array (
|
||||
'id' => '15084529',
|
||||
'mal_id' => '35003',
|
||||
'chapters' =>
|
||||
array (
|
||||
'read' => 16,
|
||||
'total' => '-',
|
||||
),
|
||||
'volumes' =>
|
||||
array (
|
||||
'read' => '-',
|
||||
'total' => '-',
|
||||
),
|
||||
'manga' =>
|
||||
array (
|
||||
'id' => '11777',
|
||||
'titles' =>
|
||||
array (
|
||||
0 => 'Yamada-kun to 7-nin no Majo',
|
||||
1 => 'Yamada-kun and the Seven Witches',
|
||||
),
|
||||
'alternate_title' => NULL,
|
||||
'slug' => 'yamada-kun-to-7-nin-no-majo',
|
||||
'url' => 'https://kitsu.io/manga/yamada-kun-to-7-nin-no-majo',
|
||||
'type' => 'manga',
|
||||
'image' => 'https://media.kitsu.io/manga/poster_images/11777/small.jpg?1438784325',
|
||||
'genres' =>
|
||||
array (
|
||||
0 => 'Comedy',
|
||||
1 => 'Ecchi',
|
||||
2 => 'Gender Bender',
|
||||
3 => 'Romance',
|
||||
4 => 'School',
|
||||
5 => 'Sports',
|
||||
6 => 'Supernatural',
|
||||
),
|
||||
),
|
||||
'reading_status' => 'current',
|
||||
'notes' => '',
|
||||
'rereading' => false,
|
||||
'reread' => 0,
|
||||
'user_rating' => 9.0,
|
||||
),
|
||||
3 =>
|
||||
array (
|
||||
'id' => '15312827',
|
||||
'mal_id' => '78523',
|
||||
'chapters' =>
|
||||
array (
|
||||
'read' => 68,
|
||||
'total' => '-',
|
||||
),
|
||||
'volumes' =>
|
||||
array (
|
||||
'read' => '-',
|
||||
'total' => '-',
|
||||
),
|
||||
'manga' =>
|
||||
array (
|
||||
'id' => '27175',
|
||||
'titles' =>
|
||||
array (
|
||||
0 => 'ReLIFE',
|
||||
),
|
||||
'alternate_title' => NULL,
|
||||
'slug' => 'relife',
|
||||
'url' => 'https://kitsu.io/manga/relife',
|
||||
'type' => 'manga',
|
||||
'image' => 'https://media.kitsu.io/manga/poster_images/27175/small.jpg?1464379411',
|
||||
'genres' =>
|
||||
array (
|
||||
0 => 'Romance',
|
||||
1 => 'School',
|
||||
2 => 'Slice of Life',
|
||||
),
|
||||
),
|
||||
'reading_status' => 'current',
|
||||
'notes' => '',
|
||||
'rereading' => false,
|
||||
'reread' => 0,
|
||||
'user_rating' => '-',
|
||||
),
|
||||
4 =>
|
||||
array (
|
||||
'id' => '15084769',
|
||||
'mal_id' => '60815',
|
||||
'chapters' =>
|
||||
array (
|
||||
'read' => 43,
|
||||
'total' => '-',
|
||||
),
|
||||
'volumes' =>
|
||||
array (
|
||||
'read' => '-',
|
||||
'total' => '-',
|
||||
),
|
||||
'manga' =>
|
||||
array (
|
||||
'id' => '25491',
|
||||
'titles' =>
|
||||
array (
|
||||
0 => 'Joshikausei',
|
||||
),
|
||||
'alternate_title' => NULL,
|
||||
'slug' => 'joshikausei',
|
||||
'url' => 'https://kitsu.io/manga/joshikausei',
|
||||
'type' => 'manga',
|
||||
'image' => 'https://media.kitsu.io/manga/poster_images/25491/small.jpg?1434305043',
|
||||
'genres' =>
|
||||
array (
|
||||
0 => 'Comedy',
|
||||
1 => 'School',
|
||||
2 => 'Slice of Life',
|
||||
),
|
||||
),
|
||||
'reading_status' => 'current',
|
||||
'notes' => '',
|
||||
'rereading' => false,
|
||||
'reread' => 0,
|
||||
'user_rating' => 8.0,
|
||||
),
|
||||
);
|
@ -0,0 +1,21 @@
|
||||
<?php return array (
|
||||
'id' => '20286',
|
||||
'title' => 'Bokura wa Minna Kawaisou',
|
||||
'en_title' => NULL,
|
||||
'jp_title' => 'Bokura wa Minna Kawaisou',
|
||||
'cover_image' => 'https://media.kitsu.io/manga/poster_images/20286/small.jpg?1434293999',
|
||||
'manga_type' => 'manga',
|
||||
'chapter_count' => '-',
|
||||
'volume_count' => '-',
|
||||
'synopsis' => 'Usa, a high-school student aspiring to begin a bachelor lifestyle, moves into a new apartment only to discover that he not only shares a room with a perverted roommate that has an obsession for underaged girls, but also that another girl, Ritsu, a love-at-first-sight, is living in the same building as well!
|
||||
(Source: Kirei Cake)',
|
||||
'url' => 'https://kitsu.io/manga/bokura-wa-minna-kawaisou',
|
||||
'genres' =>
|
||||
array (
|
||||
0 => 'Comedy',
|
||||
1 => 'Romance',
|
||||
2 => 'School',
|
||||
3 => 'Slice of Life',
|
||||
4 => 'Thriller',
|
||||
),
|
||||
);
|
Loading…
Reference in New Issue
Block a user