/** * Step 2 * Once you have the code, paste it on code.php and execute this one. * * Again, it will retrieve the valid token. * Copy and paste on test/everything_else/long_access_token.php * * Now you can execute all the tests inside the everything_else folder */ public function testAuthentication() { $code = (include __DIR__ . '/code.php'); $this->core->authenticate($code); echo 'Here is your token: ' . serialize(array('access_token' => $this->access_token_data->getLongAccessToken(), 'expires' => 5000)); $this->assertTrue($this->core->isLogged()); }
/** * @param string $job_id * * @return array * * @throws \Exception */ private function getJobResult($account_id, $job_id) { $account_id = $this->fixAccountId($account_id); $data = array('report_run_id' => $job_id, 'limit' => 5000); $result = $this->core->curl($data, '/' . $account_id . '/reportstats', 'get'); if (!isset($result->data)) { throw new \Exception('something went wrong :('); } return $result->data; }
public function testPagination() { $friendlists = $this->core->fql('select count, flid from friendlist where owner = me()'); usort($friendlists, function ($a, $b) { if ($a->count == $b->count) { return 0; } return $a->count > $b->count ? -1 : 1; }); $list = reset($friendlists); $page_size = ceil($list->count / 5); $test_result = $this->core->curl(array('limit' => $page_size), '/' . $list->flid . '/members', 'get'); /** @noinspection PhpUndefinedFieldInspection */ $this->assertCount($list->count, $test_result->data); }