public function testFacebookProviderAccount() { $requestExecutor = $this->getMock('\\Stormpath\\Http\\RequestExecutor'); $apiKey = $this->getMock('\\Stormpath\\ApiKey', array(), array("mockId", "mockSecret")); $cacheManager = $this->getMock('\\Stormpath\\Cache\\CacheManager'); $dataStore = $this->getMock('\\Stormpath\\DataStore\\DefaultDataStore', array('create'), array($requestExecutor, $apiKey, $cacheManager)); $accessToken = "4/XrsKzIJuy3ye57eqbanlQDN1wZHYfaUV-MFyC6dRjRw.wnCoOEKwnlwXXmXvfARQvthKMCbPmgI"; $providerAccountRequest = new \Stormpath\Provider\FacebookProviderAccountRequest(array("accessToken" => $accessToken)); $providerData = $providerAccountRequest->getProviderData($dataStore); $this->assertEquals(FacebookProvider::FACEBOOK_PROVIDER_ID, $providerData->providerId); $this->assertEquals($accessToken, $providerData->accessToken); $providerAccountAccess = $dataStore->instantiate(Stormpath::PROVIDER_ACCOUNT_ACCESS); $providerAccountAccess->providerData = $providerData; $application = new Application($dataStore); $providerAccountResult = $this->getMock('\\Stormpath\\Resource\\ProviderAccountResult'); $dataStore->expects($this->once())->method('create')->with($this->equalTo($application->getHref() . '/' . Account::PATH), $this->equalTo($providerAccountAccess), $this->equalTo(Stormpath::PROVIDER_ACCOUNT_RESULT))->will($this->returnValue($providerAccountResult)); $returnedResult = $application->getAccount($providerAccountRequest); $this->assertEquals($providerAccountResult, $returnedResult); }