/** * @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 $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); }