2019-01-16 21:31:52 +09:00
< ? php
namespace Tests\Unit\MetadataResolver ;
use App\MetadataResolver\DLsiteResolver ;
use Tests\TestCase ;
class DLsiteResolverTest extends TestCase
{
use CreateMockedResolver ;
2020-05-23 22:17:07 +09:00
public function setUp () : void
2019-01-16 21:31:52 +09:00
{
parent :: setUp ();
if ( ! $this -> shouldUseMock ()) {
sleep ( 1 );
}
}
2019-05-01 09:21:35 +09:00
public function testHome ()
2019-01-16 21:31:52 +09:00
{
2020-08-22 13:58:03 +09:00
$responseText = $this -> fetchSnapshot ( __DIR__ . '/../../fixture/DLsite/testHome.html' );
2019-01-16 21:31:52 +09:00
$this -> createResolver ( DLsiteResolver :: class , $responseText );
2019-05-01 09:21:35 +09:00
$metadata = $this -> resolver -> resolve ( 'https://www.dlsite.com/home/work/=/product_id/RJ221761.html' );
$this -> assertEquals ( 'ひつじ、数えてあげるっ' , $metadata -> title );
$this -> assertEquals ( 'サークル名: Butterfly Dream' . PHP_EOL . '眠れないあなたに彼女が羊を数えてくれる音声です。' , $metadata -> description );
$this -> assertEquals ( 'https://img.dlsite.jp/modpub/images2/work/doujin/RJ222000/RJ221761_img_main.jpg' , $metadata -> image );
2020-12-11 01:40:39 +09:00
$this -> assertEquals ([ 'ほのぼの' , 'バイノーラル/ダミヘ' , '恋人同士' , '日常/生活' , '癒し' ], $metadata -> tags );
2019-01-16 21:31:52 +09:00
if ( $this -> shouldUseMock ()) {
2019-05-01 09:21:35 +09:00
$this -> assertSame ( 'https://www.dlsite.com/home/work/=/product_id/RJ221761.html' , ( string ) $this -> handler -> getLastRequest () -> getUri ());
2019-01-16 21:31:52 +09:00
}
}
2019-05-01 09:21:35 +09:00
public function testSoft ()
2019-01-16 21:31:52 +09:00
{
2020-08-22 13:58:03 +09:00
$responseText = $this -> fetchSnapshot ( __DIR__ . '/../../fixture/DLsite/testSoft.html' );
2019-05-01 09:21:35 +09:00
$this -> createResolver ( DLsiteResolver :: class , $responseText );
$metadata = $this -> resolver -> resolve ( 'https://www.dlsite.com/soft/work/=/product_id/VJ011276.html' );
$this -> assertEquals ( 'ことのはアムリラート' , $metadata -> title );
2020-12-11 01:40:39 +09:00
$this -> assertEquals ( 'ブランド名: SukeraSparo' . PHP_EOL . '異世界へと迷い込んだ凜に救いの手を差し伸べるルカ――。これは、ふたりが手探りの意思疎通(ことのは)で織りなす、もどかしくも純粋な……女の子同士の物語。' , $metadata -> description );
2019-05-01 09:21:35 +09:00
$this -> assertEquals ( 'https://img.dlsite.jp/modpub/images2/work/professional/VJ012000/VJ011276_img_main.jpg' , $metadata -> image );
2020-12-11 01:40:39 +09:00
$this -> assertEquals ([ '少女' , '日常/生活' , '百合' , '純愛' ], $metadata -> tags );
2019-05-01 09:21:35 +09:00
if ( $this -> shouldUseMock ()) {
$this -> assertSame ( 'https://www.dlsite.com/soft/work/=/product_id/VJ011276.html' , ( string ) $this -> handler -> getLastRequest () -> getUri ());
}
}
public function testComic ()
{
2020-08-22 13:58:03 +09:00
$responseText = $this -> fetchSnapshot ( __DIR__ . '/../../fixture/DLsite/testComic.html' );
2019-05-01 09:21:35 +09:00
$this -> createResolver ( DLsiteResolver :: class , $responseText );
$metadata = $this -> resolver -> resolve ( 'https://www.dlsite.com/comic/work/=/product_id/BJ138581.html' );
$this -> assertEquals ( '快楽ヒストリエ' , $metadata -> title );
2019-05-02 06:24:47 +09:00
$this -> assertEquals ( '著者: 火鳥' . PHP_EOL . '天地創造と原初の人類を描いた「創世編」をはじめ、英雄たちの偉業を大真面目に考証した正真正銘の学術コミック全15編。' , $metadata -> description );
2019-05-01 09:21:35 +09:00
$this -> assertEquals ( 'https://img.dlsite.jp/modpub/images2/work/books/BJ139000/BJ138581_img_main.jpg' , $metadata -> image );
2020-12-11 01:40:39 +09:00
$this -> assertEquals ([ 'おっぱい' , 'おやじ' , 'ギャグ' , 'コメディ' , 'ショタ' , 'セーラー服' , 'ロリ' , '女王様/お姫様' , '妹' , '戦士' , '歴史/時代物' , '爺' , '王子様/王子系' , '着物/和服' , '褐色/日焼け' , '青年コミック' ], $metadata -> tags );
2019-05-01 09:21:35 +09:00
if ( $this -> shouldUseMock ()) {
$this -> assertSame ( 'https://www.dlsite.com/comic/work/=/product_id/BJ138581.html' , ( string ) $this -> handler -> getLastRequest () -> getUri ());
}
}
public function testManiax ()
{
2020-08-22 13:58:03 +09:00
$responseText = $this -> fetchSnapshot ( __DIR__ . '/../../fixture/DLsite/testManiax.html' );
2019-05-01 09:21:35 +09:00
$this -> createResolver ( DLsiteResolver :: class , $responseText );
$metadata = $this -> resolver -> resolve ( 'https://www.dlsite.com/maniax/work/=/product_id/RJ205445.html' );
$this -> assertEquals ( '催眠術で新婚人妻マナカさんとエッチしよう' , $metadata -> title );
$this -> assertEquals ( 'サークル名: デルタブレード' . PHP_EOL . '催眠術で新婚人妻マナカさんの愛する夫にすり替わって子作りラブラブエッチをするCG集です。' , $metadata -> description );
$this -> assertEquals ( 'https://img.dlsite.jp/modpub/images2/work/doujin/RJ206000/RJ205445_img_main.jpg' , $metadata -> image );
2020-12-11 01:40:39 +09:00
$this -> assertEquals ([ '中出し' , '人妻' , '催眠' , '口内射精' , '妊娠/孕ませ' , '断面図' ,], $metadata -> tags );
2019-05-01 09:21:35 +09:00
if ( $this -> shouldUseMock ()) {
$this -> assertSame ( 'https://www.dlsite.com/maniax/work/=/product_id/RJ205445.html' , ( string ) $this -> handler -> getLastRequest () -> getUri ());
}
}
public function testPro ()
{
2020-08-22 13:58:03 +09:00
$responseText = $this -> fetchSnapshot ( __DIR__ . '/../../fixture/DLsite/testPro.html' );
2019-05-01 09:21:35 +09:00
$this -> createResolver ( DLsiteResolver :: class , $responseText );
$metadata = $this -> resolver -> resolve ( 'https://www.dlsite.com/pro/work/=/product_id/VJ008455.html' );
$this -> assertEquals ( 'euphoria ( HDリマスター) Best Price版' , $metadata -> title );
$this -> assertEquals ( 'ブランド名: CLOCK UP' . PHP_EOL . 'インモラルハードコアADV「euphoria」が高解像度( 1024× 768) 版、「euphoria HDリマスター」となって登場! ' , $metadata -> description );
$this -> assertEquals ( 'https://img.dlsite.jp/modpub/images2/work/professional/VJ009000/VJ008455_img_main.jpg' , $metadata -> image );
2020-12-11 01:40:39 +09:00
$this -> assertEquals ([ 'アヘ顔' , 'スカトロ' , 'マニアック/変態' , '女教師' , '幼なじみ' , '強制/無理矢理' , '拘束' , '拷問' , '狂気' , '血液/流血' , '退廃/背徳/インモラル' ], $metadata -> tags );
2019-05-01 09:21:35 +09:00
if ( $this -> shouldUseMock ()) {
$this -> assertSame ( 'https://www.dlsite.com/pro/work/=/product_id/VJ008455.html' , ( string ) $this -> handler -> getLastRequest () -> getUri ());
}
}
public function testBooks ()
{
2020-08-22 13:58:03 +09:00
$responseText = $this -> fetchSnapshot ( __DIR__ . '/../../fixture/DLsite/testBooks.html' );
2019-05-01 09:21:35 +09:00
$this -> createResolver ( DLsiteResolver :: class , $responseText );
$metadata = $this -> resolver -> resolve ( 'https://www.dlsite.com/books/work/=/product_id/BJ191317.html' );
$this -> assertEquals ( '永遠娘 vol.6' , $metadata -> title );
2019-08-20 01:34:36 +09:00
$this -> assertEquals ( '著者: あまがえる / 玉之けだま / びんせん / 甘露アメ / 源五郎 / すみやお / 宇宙烏賊 / 毒茸人 / あやね / ガロウド / ハードボイルドよし子 / 夜歌 / 黒青郎君' . PHP_EOL . '君の命はどんな味なのだろうな?' , $metadata -> description );
2019-05-01 09:21:35 +09:00
$this -> assertEquals ( 'https://img.dlsite.jp/modpub/images2/work/books/BJ192000/BJ191317_img_main.jpg' , $metadata -> image );
2020-12-11 01:40:39 +09:00
$this -> assertEquals ([ 'ぶっかけ' , 'アヘ顔' , 'ストッキング' , 'セーラー服' , 'ツンデレ' , 'ファンタジー' , 'メイド' , 'ロリ' , '中出し' , '人外娘/モンスター娘' , '口内射精' , '妖怪' , '近親相姦' ], $metadata -> tags );
2019-05-01 09:21:35 +09:00
if ( $this -> shouldUseMock ()) {
$this -> assertSame ( 'https://www.dlsite.com/books/work/=/product_id/BJ191317.html' , ( string ) $this -> handler -> getLastRequest () -> getUri ());
}
}
public function testGirls ()
{
2020-08-22 13:58:03 +09:00
$responseText = $this -> fetchSnapshot ( __DIR__ . '/../../fixture/DLsite/testGirls.html' );
2019-05-01 09:21:35 +09:00
$this -> createResolver ( DLsiteResolver :: class , $responseText );
$metadata = $this -> resolver -> resolve ( 'https://www.dlsite.com/girls/work/=/product_id/RJ217995.html' );
$this -> assertEquals ( '体イク教師' , $metadata -> title );
$this -> assertEquals ( 'サークル名: Dusk' . PHP_EOL . '思い込みの激しい体育教師に執着されるお話' , $metadata -> description );
$this -> assertEquals ( 'https://img.dlsite.jp/modpub/images2/work/doujin/RJ218000/RJ217995_img_main.jpg' , $metadata -> image );
2020-12-11 01:40:39 +09:00
$this -> assertEquals ([ 'マニアック/変態' , 'レイプ' , '中出し' , '強制/無理矢理' , '教師' , '陵辱' ], $metadata -> tags );
2019-05-01 09:21:35 +09:00
if ( $this -> shouldUseMock ()) {
$this -> assertSame ( 'https://www.dlsite.com/girls/work/=/product_id/RJ217995.html' , ( string ) $this -> handler -> getLastRequest () -> getUri ());
}
}
public function testGirlsPro ()
{
2020-08-22 13:58:03 +09:00
$responseText = $this -> fetchSnapshot ( __DIR__ . '/../../fixture/DLsite/testGirlsPro.html' );
2019-05-01 09:21:35 +09:00
$this -> createResolver ( DLsiteResolver :: class , $responseText );
$metadata = $this -> resolver -> resolve ( 'https://www.dlsite.com/girls-pro/work/=/product_id/BJ170641.html' );
$this -> assertEquals ( '×××レクチャー' , $metadata -> title );
2020-12-11 01:40:39 +09:00
$this -> assertEquals ( '著者: 江口尋' . PHP_EOL . '【あらすじ】昔、告白してくれた地味な同級生・瀬尾は超人気セクシー男優になっていて!?…' , $metadata -> description );
2019-05-01 09:21:35 +09:00
$this -> assertEquals ( 'https://img.dlsite.jp/modpub/images2/work/books/BJ171000/BJ170641_img_main.jpg' , $metadata -> image );
2020-12-11 01:40:39 +09:00
$this -> assertEquals ([ 'ティーンズラブ' ], $metadata -> tags );
2019-05-01 09:21:35 +09:00
if ( $this -> shouldUseMock ()) {
$this -> assertSame ( 'https://www.dlsite.com/girls-pro/work/=/product_id/BJ170641.html' , ( string ) $this -> handler -> getLastRequest () -> getUri ());
}
}
public function testBL ()
{
2020-08-22 13:58:03 +09:00
$responseText = $this -> fetchSnapshot ( __DIR__ . '/../../fixture/DLsite/testBL.html' );
2019-05-01 09:21:35 +09:00
$this -> createResolver ( DLsiteResolver :: class , $responseText );
$metadata = $this -> resolver -> resolve ( 'https://www.dlsite.com/bl/work/=/product_id/RJ244977.html' );
$this -> assertEquals ( '秘密に堕つ' , $metadata -> title );
$this -> assertEquals ( 'サークル名: ナゲットぶん投げ屋さん' . PHP_EOL . 'とある村に越してきた新婚夫婦。村の集会所で行われた歓迎会で犯される花婿。村の男達に犯され続けた花婿にある変化が…?' , $metadata -> description );
$this -> assertEquals ( 'https://img.dlsite.jp/modpub/images2/work/doujin/RJ245000/RJ244977_img_main.jpg' , $metadata -> image );
2020-12-11 01:40:39 +09:00
$this -> assertEquals ([ 'モブ姦' , 'レイプ' , '中出し' , '強制/無理矢理' , '既婚者' ], $metadata -> tags );
2019-05-01 09:21:35 +09:00
if ( $this -> shouldUseMock ()) {
$this -> assertSame ( 'https://www.dlsite.com/bl/work/=/product_id/RJ244977.html' , ( string ) $this -> handler -> getLastRequest () -> getUri ());
}
}
public function testEng ()
{
2020-08-22 13:58:03 +09:00
$responseText = $this -> fetchSnapshot ( __DIR__ . '/../../fixture/DLsite/testEng.html' );
2019-05-01 09:21:35 +09:00
$this -> createResolver ( DLsiteResolver :: class , $responseText );
$metadata = $this -> resolver -> resolve ( 'https://www.dlsite.com/eng/work/=/product_id/RE228866.html' );
$this -> assertEquals ( 'With Your First Girlfriend, at a Ghostly Night [Ear Cleaning] [Sleep Sharing]' , $metadata -> title );
$this -> assertEquals ( 'Circle: Triangle!' . PHP_EOL . 'You go with a girl of your first love and enjoy going to haunted places and her massage, ear cleaning, sleep sharing etc. (CV: Yui Asami)' , $metadata -> description );
$this -> assertEquals ( 'https://img.dlsite.jp/modpub/images2/work/doujin/RJ229000/RJ228866_img_main.jpg' , $metadata -> image );
2020-12-11 01:40:39 +09:00
$this -> assertEquals ([ 'ASMR' , 'Binaural' , 'Childhood Friend' , 'Ear Cleaning' , 'Healing' , 'Lovey Dovey/Sweet Love' ], $metadata -> tags );
2019-05-01 09:21:35 +09:00
if ( $this -> shouldUseMock ()) {
$this -> assertSame ( 'https://www.dlsite.com/eng/work/=/product_id/RE228866.html' , ( string ) $this -> handler -> getLastRequest () -> getUri ());
}
}
public function testEcchiEng ()
{
2020-08-22 13:58:03 +09:00
$responseText = $this -> fetchSnapshot ( __DIR__ . '/../../fixture/DLsite/testEcchiEng.html' );
2019-05-01 09:21:35 +09:00
$this -> createResolver ( DLsiteResolver :: class , $responseText );
$metadata = $this -> resolver -> resolve ( 'https://www.dlsite.com/ecchi-eng/work/=/product_id/RE144678.html' );
$this -> assertEquals ( 'NEKOPARA vol.1' , $metadata -> title );
$this -> assertEquals ( 'Circle: NEKO WORKs' . PHP_EOL . 'Chocolat and Vanilla star in a rich adult eroge series with E-mote system and animated H scenes' , $metadata -> description );
$this -> assertEquals ( 'https://img.dlsite.jp/modpub/images2/work/doujin/RJ145000/RJ144678_img_main.jpg' , $metadata -> image );
2020-12-11 01:40:39 +09:00
$this -> assertEquals ([ 'Love Comedy/Romcom' , 'Master and Servant' , 'Moe' , 'Nekomimi (Cat Ears)' ], $metadata -> tags );
2019-05-01 09:21:35 +09:00
if ( $this -> shouldUseMock ()) {
$this -> assertSame ( 'https://www.dlsite.com/ecchi-eng/work/=/product_id/RE144678.html' , ( string ) $this -> handler -> getLastRequest () -> getUri ());
}
}
public function testSPLink ()
{
2020-08-22 13:58:03 +09:00
$responseText = $this -> fetchSnapshot ( __DIR__ . '/../../fixture/DLsite/testHome.html' );
2019-04-30 07:52:45 +09:00
// SP版( touch) のURLのテストだがリゾルバ側でURLから-touchを削除してPC版を取得するので、PC版の内容を使用する
2019-01-16 21:31:52 +09:00
$this -> createResolver ( DLsiteResolver :: class , $responseText );
2019-06-08 01:47:27 +09:00
$metadata = $this -> resolver -> resolve ( 'https://www.dlsite.com/home-touch/work/=/product_id/RJ221761.html' );
2019-05-01 09:21:35 +09:00
$this -> assertEquals ( 'ひつじ、数えてあげるっ' , $metadata -> title );
$this -> assertEquals ( 'サークル名: Butterfly Dream' . PHP_EOL . '眠れないあなたに彼女が羊を数えてくれる音声です。' , $metadata -> description );
$this -> assertEquals ( 'https://img.dlsite.jp/modpub/images2/work/doujin/RJ222000/RJ221761_img_main.jpg' , $metadata -> image );
2020-12-11 01:40:39 +09:00
$this -> assertEquals ([ 'ほのぼの' , 'バイノーラル/ダミヘ' , '恋人同士' , '日常/生活' , '癒し' ], $metadata -> tags );
2019-01-16 21:31:52 +09:00
if ( $this -> shouldUseMock ()) {
2019-05-01 09:21:35 +09:00
$this -> assertSame ( 'https://www.dlsite.com/home/work/=/product_id/RJ221761.html' , ( string ) $this -> handler -> getLastRequest () -> getUri ());
2019-01-16 21:31:52 +09:00
}
}
2019-03-08 05:09:26 +09:00
2019-05-01 09:21:35 +09:00
public function testShortLink ()
2019-03-08 05:09:26 +09:00
{
2020-08-22 13:58:03 +09:00
$responseText = $this -> fetchSnapshot ( __DIR__ . '/../../fixture/DLsite/testHome.html' );
2019-03-08 05:09:26 +09:00
$this -> createResolver ( DLsiteResolver :: class , $responseText );
2019-06-08 01:47:27 +09:00
$metadata = $this -> resolver -> resolve ( 'https://dlsite.jp/howtw/RJ221761.html' );
2019-05-01 09:21:35 +09:00
$this -> assertEquals ( 'ひつじ、数えてあげるっ' , $metadata -> title );
$this -> assertEquals ( 'サークル名: Butterfly Dream' . PHP_EOL . '眠れないあなたに彼女が羊を数えてくれる音声です。' , $metadata -> description );
$this -> assertEquals ( 'https://img.dlsite.jp/modpub/images2/work/doujin/RJ222000/RJ221761_img_main.jpg' , $metadata -> image );
2020-12-11 01:40:39 +09:00
$this -> assertEquals ([ 'ほのぼの' , 'バイノーラル/ダミヘ' , '恋人同士' , '日常/生活' , '癒し' ], $metadata -> tags );
2019-03-08 05:09:26 +09:00
if ( $this -> shouldUseMock ()) {
2019-06-08 01:47:27 +09:00
$this -> assertSame ( 'https://dlsite.jp/howtw/RJ221761.html' , ( string ) $this -> handler -> getLastRequest () -> getUri ());
2019-03-08 05:09:26 +09:00
}
}
2019-08-26 23:33:52 +09:00
2019-11-08 05:36:40 +09:00
public function testOldAffiliateLink ()
2019-08-26 23:33:52 +09:00
{
2020-08-22 13:58:03 +09:00
$responseText = $this -> fetchSnapshot ( __DIR__ . '/../../fixture/DLsite/testHome.html' );
2019-08-26 23:33:52 +09:00
$this -> createResolver ( DLsiteResolver :: class , $responseText );
$metadata = $this -> resolver -> resolve ( 'https://www.dlsite.com/home/dlaf/=/link/work/aid/eai04191/id/RJ221761.html' );
$this -> assertEquals ( 'ひつじ、数えてあげるっ' , $metadata -> title );
$this -> assertEquals ( 'サークル名: Butterfly Dream' . PHP_EOL . '眠れないあなたに彼女が羊を数えてくれる音声です。' , $metadata -> description );
$this -> assertEquals ( 'https://img.dlsite.jp/modpub/images2/work/doujin/RJ222000/RJ221761_img_main.jpg' , $metadata -> image );
2020-12-11 01:40:39 +09:00
$this -> assertEquals ([ 'ほのぼの' , 'バイノーラル/ダミヘ' , '恋人同士' , '日常/生活' , '癒し' ], $metadata -> tags );
2019-11-08 05:36:40 +09:00
if ( $this -> shouldUseMock ()) {
$this -> assertSame ( 'https://www.dlsite.com/home/work/=/product_id/RJ221761.html' , ( string ) $this -> handler -> getLastRequest () -> getUri ());
}
}
public function testSnsAffiliateLink ()
{
2020-08-22 13:58:03 +09:00
$responseText = $this -> fetchSnapshot ( __DIR__ . '/../../fixture/DLsite/testHome.html' );
2019-11-08 05:36:40 +09:00
$this -> createResolver ( DLsiteResolver :: class , $responseText );
$metadata = $this -> resolver -> resolve ( 'https://www.dlsite.com/home/dlaf/=/t/s/link/work/aid/eai04191/id/RJ221761.html' );
$this -> assertEquals ( 'ひつじ、数えてあげるっ' , $metadata -> title );
$this -> assertEquals ( 'サークル名: Butterfly Dream' . PHP_EOL . '眠れないあなたに彼女が羊を数えてくれる音声です。' , $metadata -> description );
$this -> assertEquals ( 'https://img.dlsite.jp/modpub/images2/work/doujin/RJ222000/RJ221761_img_main.jpg' , $metadata -> image );
2020-12-11 01:40:39 +09:00
$this -> assertEquals ([ 'ほのぼの' , 'バイノーラル/ダミヘ' , '恋人同士' , '日常/生活' , '癒し' ], $metadata -> tags );
2019-11-08 05:36:40 +09:00
if ( $this -> shouldUseMock ()) {
$this -> assertSame ( 'https://www.dlsite.com/home/work/=/product_id/RJ221761.html' , ( string ) $this -> handler -> getLastRequest () -> getUri ());
}
}
public function testAffiliateLink ()
{
2020-08-22 13:58:03 +09:00
$responseText = $this -> fetchSnapshot ( __DIR__ . '/../../fixture/DLsite/testHome.html' );
2019-11-08 05:36:40 +09:00
$this -> createResolver ( DLsiteResolver :: class , $responseText );
$metadata = $this -> resolver -> resolve ( 'https://www.dlsite.com/home/dlaf/=/t/t/link/work/aid/eai04191/id/RJ221761.html' );
$this -> assertEquals ( 'ひつじ、数えてあげるっ' , $metadata -> title );
$this -> assertEquals ( 'サークル名: Butterfly Dream' . PHP_EOL . '眠れないあなたに彼女が羊を数えてくれる音声です。' , $metadata -> description );
$this -> assertEquals ( 'https://img.dlsite.jp/modpub/images2/work/doujin/RJ222000/RJ221761_img_main.jpg' , $metadata -> image );
2020-12-11 01:40:39 +09:00
$this -> assertEquals ([ 'ほのぼの' , 'バイノーラル/ダミヘ' , '恋人同士' , '日常/生活' , '癒し' ], $metadata -> tags );
2019-08-26 23:33:52 +09:00
if ( $this -> shouldUseMock ()) {
$this -> assertSame ( 'https://www.dlsite.com/home/work/=/product_id/RJ221761.html' , ( string ) $this -> handler -> getLastRequest () -> getUri ());
}
}
public function testAffiliateUrl ()
{
2020-08-22 13:58:03 +09:00
$responseText = $this -> fetchSnapshot ( __DIR__ . '/../../fixture/DLsite/testHome.html' );
2019-08-26 23:33:52 +09:00
$this -> createResolver ( DLsiteResolver :: class , $responseText );
$metadata = $this -> resolver -> resolve ( 'http://www.dlsite.com/home/dlaf/=/aid/eai04191/url/https%3A%2F%2Fwww.dlsite.com%2Fhome%2Fwork%2F=%2Fproduct_id%2FRJ221761.html' );
$this -> assertEquals ( 'ひつじ、数えてあげるっ' , $metadata -> title );
$this -> assertEquals ( 'サークル名: Butterfly Dream' . PHP_EOL . '眠れないあなたに彼女が羊を数えてくれる音声です。' , $metadata -> description );
$this -> assertEquals ( 'https://img.dlsite.jp/modpub/images2/work/doujin/RJ222000/RJ221761_img_main.jpg' , $metadata -> image );
2020-12-11 01:40:39 +09:00
$this -> assertEquals ([ 'ほのぼの' , 'バイノーラル/ダミヘ' , '恋人同士' , '日常/生活' , '癒し' ], $metadata -> tags );
2019-08-26 23:33:52 +09:00
if ( $this -> shouldUseMock ()) {
$this -> assertSame ( 'https://www.dlsite.com/home/work/=/product_id/RJ221761.html' , ( string ) $this -> handler -> getLastRequest () -> getUri ());
}
}
2019-08-26 23:46:44 +09:00
public function testAffiliateBadUrl ()
{
$this -> createResolver ( DLsiteResolver :: class , '' );
$this -> expectException ( \RuntimeException :: class );
$this -> expectExceptionMessage ( 'アフィリエイト先のリンクがDLsiteのタイトルではありません: https://www.dlsite.com/home/' );
$this -> resolver -> resolve ( 'http://www.dlsite.com/home/dlaf/=/aid/eai04191/url/https%3A%2F%2Fwww.dlsite.com%2Fhome%2F' );
}
2019-08-28 00:31:20 +09:00
2019-08-20 00:52:00 +09:00
public function testHTMLdescription ()
{
2020-08-22 13:58:03 +09:00
$responseText = $this -> fetchSnapshot ( __DIR__ . '/../../fixture/DLsite/testHTMLdescription.html' );
2019-08-20 00:52:00 +09:00
$this -> createResolver ( DLsiteResolver :: class , $responseText );
$metadata = $this -> resolver -> resolve ( 'https://www.dlsite.com/books/work/=/product_id/BJ123822.html' );
$this -> assertEquals ( '獣○彼女カタログ' , $metadata -> title );
$this -> assertEquals ( '著者: チキコ / MUJIN編集部' . PHP_EOL . '【DLsite.com独占販売】 エロ漫画界騒然、1冊まるごと獣○オンリー単行本! 人間チ×ポは出てきませんっ!!' , $metadata -> description );
$this -> assertEquals ( 'https://img.dlsite.jp/modpub/images2/work/books/BJ124000/BJ123822_img_main.jpg' , $metadata -> image );
2020-12-11 01:40:39 +09:00
$this -> assertEquals ([ 'フェラチオ' , 'メイド' , '中出し' , '処女' , '制服' , '巨乳/爆乳' , '巫女' , '断面図' , '水着' , '異種姦' , '複数プレイ/乱交' , '褐色/日焼け' , '軍服' ], $metadata -> tags );
2019-08-20 00:52:00 +09:00
if ( $this -> shouldUseMock ()) {
$this -> assertSame ( 'https://www.dlsite.com/books/work/=/product_id/BJ123822.html' , ( string ) $this -> handler -> getLastRequest () -> getUri ());
}
}
2019-01-16 21:31:52 +09:00
}