Skip to content

Commit

Permalink
Clean up #92 & add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
SammyK committed Nov 12, 2015
1 parent 816aea7 commit efdf665
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
15 changes: 11 additions & 4 deletions src/LaravelFacebookSdk/LaravelFacebookSdk.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,14 @@ class LaravelFacebookSdk extends Facebook
protected $url;

/**
* @param Config $config_handler
* @param Url $url
* @param array $config
* @var array
*/
private $default_config;

/**
* @param Config $config_handler
* @param Url $url
* @param array $config
*/
public function __construct(Config $config_handler, Url $url, array $config)
{
Expand All @@ -31,7 +36,9 @@ public function __construct(Config $config_handler, Url $url, array $config)
}

/**
* @param array $config
* @param array $config
*
* @return LaravelFacebookSdk
*/
public function newInstance(array $config)
{
Expand Down
13 changes: 12 additions & 1 deletion tests/LaravelFacebookSdkTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

class LaravelFacebookSdkTest extends \PHPUnit_Framework_TestCase
{

/**
* @var \Illuminate\Config\Repository|\Mockery\MockInterface
*/
Expand Down Expand Up @@ -82,4 +81,16 @@ public function the_default_config_can_be_overwritten_by_passing_arguments_to_ge
$this->assertContains('scope=dance%2Ctotes', $login_url);
}

/** @test */
public function the_a_new_instance_can_be_generated_with_new_app_config()
{
$fb = $this->laravel_facebook_sdk->newInstance([
'app_id' => 'app2_id',
'app_secret' => 'app2_secret',
]);

$app_token = (string) $fb->getApp()->getAccessToken();

$this->assertEquals('app2_id|app2_secret', $app_token);
}
}

0 comments on commit efdf665

Please sign in to comment.