public function testSessionInfo() { $params = array('input_token' => FacebookTestHelper::$testSession->getToken()); $response = (new FacebookRequest(new FacebookSession(FacebookTestHelper::getAppToken()), 'GET', '/debug_token', $params))->execute()->getGraphObject(GraphSessionInfo::className()); $this->assertTrue($response instanceof GraphSessionInfo); $this->assertNotNull($response->getAppId()); $this->assertTrue($response->isValid()); }
public function testCanPostAndDelete() { // Create a test user $params = array('name' => 'Foo User'); $response = (new FacebookRequest(new FacebookSession(FacebookTestHelper::getAppToken()), 'POST', '/' . FacebookTestCredentials::$appId . '/accounts/test-users', $params))->execute()->getGraphObject(); $user_id = $response->getProperty('id'); $this->assertNotNull($user_id); // Delete test user $response = (new FacebookRequest(new FacebookSession(FacebookTestHelper::getAppToken()), 'DELETE', '/' . $user_id))->execute()->getGraphObject()->asArray(); $this->assertTrue($response); }
public function testSessionToken() { $session = new FacebookSession(FacebookTestHelper::getAppToken()); $this->assertEquals(FacebookTestHelper::getAppToken(), $session->getToken()); }
* * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * */ require_once __DIR__ . '/../vendor/autoload.php'; use Facebook\FacebookSDKException; use Facebook\Tests\FacebookTestHelper; if (!file_exists(__DIR__ . '/FacebookTestCredentials.php')) { throw new FacebookSDKException('You must create a FacebookTestCredentials.php file from FacebookTestCredentials.php.dist'); } // Uncomment two lines to force functional test curl implementation //use Facebook\HttpClients\FacebookCurlHttpClient; //FacebookRequest::setHttpClientHandler(new FacebookCurlHttpClient()); // Uncomment two lines to force functional test stream wrapper implementation //use Facebook\HttpClients\FacebookStreamHttpClient; //FacebookRequest::setHttpClientHandler(new FacebookStreamHttpClient()); // Uncomment two lines to force functional test Guzzle implementation //use Facebook\HttpClients\FacebookGuzzleHttpClient; //FacebookRequest::setHttpClientHandler(new FacebookGuzzleHttpClient()); // Create a temp test user to use for testing FacebookTestHelper::initialize(); // Delete the temp test user after all tests have fired register_shutdown_function(function () { FacebookTestHelper::deleteTestUser(); });