diff --git a/tests/Unit/MetadataResolver/FC2ContentsResolverTest.php b/tests/Unit/MetadataResolver/FC2ContentsResolverTest.php new file mode 100644 index 0000000..2cce224 --- /dev/null +++ b/tests/Unit/MetadataResolver/FC2ContentsResolverTest.php @@ -0,0 +1,50 @@ +shouldUseMock()) { + sleep(1); + } + } + + public function testAdult() + { + $responseText = file_get_contents(__DIR__.'/../../fixture/FC2Contents/adult.html'); + + $this->createResolver(FC2ContentsResolver::class, $responseText); + + $metadata = $this->resolver->resolve('https://adult.contents.fc2.com/article_search.php?id=401545'); + $this->assertEquals('個人撮影@「ぱいずりオアトリート♡」Jカップ魔女っ子の3連挟射しても続けちゃうパイズリ!', $metadata->title); + $this->assertEquals('個人撮影@「ぱいずりオアトリート♡」Jカップ魔女っ子の3連挟射しても続けちゃうパイズリ! - イベントコスチュームということもあり、大ボリュームだった前回、前々回の パイズリ役Jcupメイド と ナースパイズリを超え 今回さらに超ボリューム&超密度の内容になってます! -------- …', $metadata->description); + $this->assertEquals('https://storage2000.contents.fc2.com/file/104/10362633/1477676255.72.png', $metadata->image); + if ($this->shouldUseMock()) { + $this->assertSame('https://adult.contents.fc2.com/article_search.php?id=401545', (string) $this->handler->getLastRequest()->getUri()); + } + } + + public function testGeneral() + { + $responseText = file_get_contents(__DIR__.'/../../fixture/FC2Contents/general.html'); + + $this->createResolver(FC2ContentsResolver::class, $responseText); + + $metadata = $this->resolver->resolve('https://contents.fc2.com/article_search.php?id=336610'); + $this->assertEquals('ゆかいなどうぶつたち ~オオカミ・キツネ・タヌキ~', $metadata->title); + $this->assertEquals('ゆかいなどうぶつたち ~オオカミ・キツネ・タヌキ~ - 今回のおともだちは、オオカミ・キツネ・タヌキだよ。地球上に住んでいるたくさんのおともだち、みんなにどんどん紹介するからたのしみにしてね!', $metadata->description); + $this->assertEquals('https://storage6000.contents.fc2.com/file/300/29917555/1519118184.65.jpg', $metadata->image); + if ($this->shouldUseMock()) { + $this->assertSame('https://contents.fc2.com/article_search.php?id=336610', (string) $this->handler->getLastRequest()->getUri()); + } + } +} diff --git a/tests/fixture/FC2Contents/adult.html b/tests/fixture/FC2Contents/adult.html new file mode 100644 index 0000000..781163f --- /dev/null +++ b/tests/fixture/FC2Contents/adult.html @@ -0,0 +1,15 @@ + + + + 個人撮影@「ぱいずりオアトリート♡」Jカップ魔女っ子の3連挟射しても続けちゃうパイズリ! + + + + +
+ + + +
+ + \ No newline at end of file diff --git a/tests/fixture/FC2Contents/general.html b/tests/fixture/FC2Contents/general.html new file mode 100644 index 0000000..8510488 --- /dev/null +++ b/tests/fixture/FC2Contents/general.html @@ -0,0 +1,15 @@ + + + + ゆかいなどうぶつたち ~オオカミ・キツネ・タヌキ~ + + + + +
+ + + +
+ +