diff --git a/tests/Unit/MetadataResolver/NicoSeigaResolverTest.php b/tests/Unit/MetadataResolver/NicoSeigaResolverTest.php new file mode 100644 index 0000000..0c1c0bd --- /dev/null +++ b/tests/Unit/MetadataResolver/NicoSeigaResolverTest.php @@ -0,0 +1,52 @@ +shouldUseMock()) { + sleep(1); + } + } + + public function testSeiga() + { + $responseText = file_get_contents(__DIR__ . '/../../fixture/NicoSeiga/seiga.html'); + + $this->createResolver(NicoSeigaResolver::class, $responseText); + + $metadata = $this->resolver->resolve('https://seiga.nicovideo.jp/seiga/im9623750'); + $this->assertSame('シャミ子 / まとけち さんのイラスト', $metadata->title); + $this->assertSame('シャミ子が悪いんだよ・・・', $metadata->description); + $this->assertSame('https://lohas.nicoseiga.jp/thumb/9623750l?', $metadata->image); + $this->assertSame(['アニメ', 'まちカドまぞく', 'シャミ子', 'シャドウミストレス優子', '吉田優子', '危機管理フォーム', 'シャミ子が悪いんだよ', '赤面', 'シャミ子は悪くないよ'], $metadata->tags); + if ($this->shouldUseMock()) { + $this->assertSame('https://seiga.nicovideo.jp/seiga/im9623750', (string) $this->handler->getLastRequest()->getUri()); + } + } + + public function testShunga() + { + $responseText = file_get_contents(__DIR__ . '/../../fixture/NicoSeiga/shunga.html'); + + $this->createResolver(NicoSeigaResolver::class, $responseText); + + $metadata = $this->resolver->resolve('https://seiga.nicovideo.jp/seiga/im9232798'); + $this->assertSame('ベッドのゆかりさん / せゆーら/Se-U-Ra さんのイラスト', $metadata->title); + $this->assertSame('待つ側の方がつよいってスマブラが伝えてきたので', $metadata->description); + $this->assertSame('https://lohas.nicoseiga.jp/thumb/9232798l?', $metadata->image); + $this->assertSame(['結月ゆかり', 'VOICEROID', '裸パーカー', '謎の光'], $metadata->tags); + if ($this->shouldUseMock()) { + $this->assertSame('https://seiga.nicovideo.jp/seiga/im9232798', (string) $this->handler->getLastRequest()->getUri()); + } + } +} diff --git a/tests/fixture/NicoSeiga/seiga.html b/tests/fixture/NicoSeiga/seiga.html new file mode 100644 index 0000000..fd601c5 --- /dev/null +++ b/tests/fixture/NicoSeiga/seiga.html @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + + + + + + +シャミ子 / まとけち さんのイラスト - ニコニコ静画 (イラスト) + + + + + + + + + + + + + + + + +
+
+ + +
+ +
+ ログインすることで、フルサイズの画像を閲覧・コメントの投稿ができます。 +
+ + + + + + + +
+ + シャミ子 +
+

シャミ子

+
投稿者:まとけち さん
+
シャミ子が悪いんだよ・・・
+ +
2019年09月07日 18:17:19 投稿
+
登録タグ
+ +
+
+ + +
+
+ + + diff --git a/tests/fixture/NicoSeiga/shunga.html b/tests/fixture/NicoSeiga/shunga.html new file mode 100644 index 0000000..3b05543 --- /dev/null +++ b/tests/fixture/NicoSeiga/shunga.html @@ -0,0 +1,89 @@ + + + + + + + + + + + + + + + + + + + + + + +ベッドのゆかりさん / せゆーら/Se-U-Ra さんのイラスト - ニコニコ静画 (イラスト) + + + + + + + + + + + + + + + + +
+
+ + +
+ +
+ ログインすることで、フルサイズの画像を閲覧・コメントの投稿ができます。 +
+ + + + + + + +
+
+ 15歳未満の方には不適切な表現が含まれる可能性があるため
サムネイルを非表示にしています +
+ + ベッドのゆかりさん + +
+

ベッドのゆかりさん

+
投稿者:せゆーら/Se-U-Ra さん
+
待つ側の方がつよいってスマブラが伝えてきたので
+ +
2019年05月07日 12:59:32 投稿
+
登録タグ
+
+ +    +    +    +    +    +
+
+
+ + +
+
+ + +