/**
  * @param \Laelaps\Bundle\Facebook\FacebookAdapter $facebookAdapter
  * @param \Symfony\Component\HttpFoundation\Request $request
  * @param \PHPUnit_Framework_TestCase $phpunit
  * @return void
  */
 public function testThatSessionCanBeFetchedBasingOnRequest(FacebookAdapter $facebookAdapter, Request $request, PHPUnit_Framework_TestCase $phpunit)
 {
     $facebookAdapter->setContainer(null);
     $facebookAdapter->setRequest($request);
     $facebookAdapter->setSession(null);
     $phpunit->assertSame($facebookAdapter->getSession(), $request->getSession());
 }
 /**
  * @param \Laelaps\Bundle\Facebook\FacebookAdapter
  * @return void
  */
 private function assertRequestIsNotSet(FacebookAdapter $facebook)
 {
     try {
         $facebook->getRequest();
     } catch (BadMethodCallException $requestIsNotSet) {
     }
     $this->assertTrue(isset($requestIsNotSet));
 }
 /**
  * @param \Laelaps\Bundle\Facebook\FacebookAdapter $facebookAdapter
  * @return \Laelaps\Bundle\Facebook\FacebookAdapter\FacebookAdapterMock
  */
 public static function fromFacebookAdapter(FacebookAdapter $facebookAdapter)
 {
     try {
         $session = $facebookAdapter->getSession();
     } catch (BadMethodCallException $e) {
         $session = null;
     }
     $sessionNamespace = $facebookAdapter->getSessionNamespace();
     try {
         $request = $facebookAdapter->getRequest();
     } catch (BadMethodCallException $e) {
         $request = null;
     }
     try {
         $container = $facebookAdapter->getContainer();
     } catch (BadMethodCallException $e) {
         $container = null;
     }
     return new static($facebookAdapter->config, $session, $sessionNamespace, $request, $container);
 }
 /**
  * @param \Laelaps\Bundle\Facebook\FacebookAdapter $facebookAdapter
  * @param array $permissions
  */
 public function __construct(FacebookAdapter $facebookAdapter, array $permissions = [])
 {
     $redirectUrl = $facebookAdapter->getLoginUrl(['scope' => $permissions]);
     parent::__construct($redirectUrl);
 }