Skip to content

Commit

Permalink
Add tests for #77 - data needed
Browse files Browse the repository at this point in the history
  • Loading branch information
pgrimaud committed Jun 19, 2020
1 parent 5705bac commit 7e6a674
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![Build Status](https://travis-ci.org/pgrimaud/instagram-user-feed.svg?branch=master)](https://travis-ci.org/pgrimaud/instagram-user-feed)
[![Packagist](https://img.shields.io/badge/packagist-install-brightgreen.svg)](https://packagist.org/packages/pgrimaud/instagram-user-feed)
[![Coverage Status](https://coveralls.io/repos/github/pgrimaud/instagram-user-feed/badge.svg)](https://coveralls.io/github/pgrimaud/instagram-user-feed)
[![Coverage Status](https://coveralls.io/repos/github/pgrimaud/instagram-user-feed/badge.svg?branch=6.x)](https://coveralls.io/github/pgrimaud/instagram-user-feed?branch=6.x)

[![Minimum PHP Version](https://img.shields.io/packagist/php-v/pgrimaud/instagram-user-feed.svg?maxAge=3600)](https://packagist.org/packages/pgrimaud/instagram-user-feed)
[![Last version](https://img.shields.io/packagist/v/pgrimaud/instagram-user-feed?maxAge=3600)](https://packagist.org/packages/pgrimaud/instagram-user-feed)
Expand All @@ -22,7 +22,7 @@ If you like or use this package, please share your love by starring this reposit
- Fetch highlights stories of user
- Fetch detailed post of user

**⚠️ Version ^5.0 is no more maintained.**
**⚠️ Version ^5.0 is no more maintained. ⚠️**

## Version ^6.0
This version can retrieve **ANY** Instagram feed using **web scrapping**.
Expand Down
26 changes: 26 additions & 0 deletions tests/ApiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,32 @@ public function testGetMediaDetailed()
$this->assertCount(3, $mediaDetailed->getDisplayResources());


$api->logout();
}

public function testProfileFetchWithContentInAdditionalData()
{
$cachePool = new FilesystemAdapter('Instagram', 0, __DIR__ . '/cache');

$mock = new MockHandler([
new Response(200, ['Set-Cookie' => 'cookie'], file_get_contents(__DIR__ . '/fixtures/instagram-home.html')),
new Response(200, [], file_get_contents(__DIR__ . '/fixtures/instagram-login-success.json')),
new Response(200, [], file_get_contents(__DIR__ . '/fixtures/instagram-profile-additional-data.html')),
]);

$handlerStack = HandlerStack::create($mock);
$client = new Client(['handler' => $handlerStack]);

$api = new Api($cachePool, $client);

// clear cache
$api->logout();

$api->login('username', 'password');
$profile = $api->getProfile('robertdowneyjr');

$this->assertSame('robertdowneyjr', $profile->getUserName());

$api->logout();
}
}
1 change: 1 addition & 0 deletions tests/fixtures/instagram-profile-additional-data.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
NEED DATA

0 comments on commit 7e6a674

Please sign in to comment.