@@ -40,6 +40,11 @@ class ApiTest extends \PHPUnit_Framework_TestCase
4040 */
4141 private $ validHtmlClient ;
4242
43+ /**
44+ * @var Client
45+ */
46+ private $ validStatementHtmlClient ;
47+
4348 /**
4449 * @var Client
4550 */
@@ -71,9 +76,10 @@ public function setUp()
7176
7277 copy (__DIR__ . '/cache/invalid/demo.cache ' , __DIR__ . '/cache/invalid/pgrimaud.cache ' );
7378
74- $ validHtmlFixtures = file_get_contents (__DIR__ . '/fixtures/pgrimaud.html ' );
75- $ invalidHtmlJsonFixtures = file_get_contents (__DIR__ . '/fixtures/invalid_pgrimaud.html ' );
76- $ invalidHtmlFixtures = '<html></html> ' ;
79+ $ validHtmlFixtures = file_get_contents (__DIR__ . '/fixtures/pgrimaud.html ' );
80+ $ validStatementHtmlFixtures = file_get_contents (__DIR__ . '/fixtures/statement.paris.html ' );
81+ $ invalidHtmlJsonFixtures = file_get_contents (__DIR__ . '/fixtures/invalid_pgrimaud.html ' );
82+ $ invalidHtmlFixtures = '<html></html> ' ;
7783
7884 $ validJsonFixtures = file_get_contents (__DIR__ . '/fixtures/pgrimaud.json ' );
7985 $ invalidJsonFixtures = '<html></html> ' ;
@@ -87,6 +93,11 @@ public function setUp()
8793 $ handler = HandlerStack::create ($ mock );
8894 $ this ->validHtmlClient = new Client (['handler ' => $ handler ]);
8995
96+ $ response = new Response (200 , $ headers , $ validStatementHtmlFixtures );
97+ $ mock = new MockHandler ([$ response ]);
98+ $ handler = HandlerStack::create ($ mock );
99+ $ this ->validStatementHtmlClient = new Client (['handler ' => $ handler ]);
100+
90101 $ response = new Response (200 , [], $ invalidHtmlFixtures );
91102 $ mock = new MockHandler ([$ response ]);
92103 $ handler = HandlerStack::create ($ mock );
@@ -350,4 +361,22 @@ public function testHtmlFeedWithNoCacheManager()
350361 $ api ->setEndCursor ('endCursor ' );
351362 $ api ->getFeed ();
352363 }
364+
365+ /**
366+ * @throws CacheException
367+ * @throws InstagramException
368+ * @throws \GuzzleHttp\Exception\GuzzleException
369+ */
370+ public function testStatementHtmlFeedWithVideoPost ()
371+ {
372+ $ api = new Api ($ this ->validCacheManager , $ this ->validStatementHtmlClient );
373+ $ api ->setUserName ('statement.paris ' );
374+
375+ $ feed = $ api ->getFeed ();
376+
377+ // fist media is a video
378+ /** @var Media $post */
379+ $ media = $ feed ->getMedias ()[0 ];
380+ $ this ->assertSame (199 , $ media ->getVideoViewCount ());
381+ }
353382}
0 commit comments