public function getGithubIssues($state = null) { $api = new phpGitHubApi(); return $api->listIssues($this->getGithubUsername(), $this->getGithubRepo(), $state); }
<?php require_once dirname(__FILE__) . '/../../vendor/lime.php'; require_once dirname(__FILE__) . '/../../lib/phpGitHubApi.php'; $t = new lime_test(3); $api = new phpGitHubApi(true); $t->comment('Test ->listIssues'); $issues = $api->listIssues('ornicar', 'php-github-api', 'closed'); $t->is($issues[0]['state'], 'closed', 'Found closed issues'); $t->comment('Test ->searchIssues'); $issues = $api->searchIssues('ornicar', 'php-github-api', 'closed', 'documentation'); $t->is($issues[0]['state'], 'closed', 'Found closed issues matching "documentation"'); $issue = $api->showIssue('ornicar', 'php-github-api', 1); $t->is($issue['title'], 'Provide documentation', 'Found issue #1');
<?php require_once dirname(__FILE__) . '/vendor/lime.php'; require_once dirname(__FILE__) . '/../lib/phpGitHubApi.php'; $t = new lime_test(); $username = '******'; $repo = 'php-github-api'; $github = new phpGitHubApi(true); $t->comment('List issues'); $issues = $github->getIssueApi()->getList($username, $repo, 'closed'); $t->is($issues[0]['state'], 'closed', 'Found closed issues'); $t->is_deeply($github->listIssues($username, $repo, 'closed'), $issues, 'Both new and BC syntax work'); $t->comment('Search issues'); $issues = $github->getIssueApi()->search($username, $repo, 'closed', 'documentation'); $t->is($issues[0]['state'], 'closed', 'Found closed issues matching "documentation"'); $t->is_deeply($github->searchIssues($username, $repo, 'closed', 'documentation'), $issues, 'Both new and BC syntax work'); $t->comment('Show issue'); $issue = $github->getIssueApi()->show($username, $repo, 1); $t->is($issue['title'], 'Provide documentation', 'Found issue #1'); $t->is_deeply($github->showIssue($username, $repo, 1), $issue, 'Both new and BC syntax work'); $username = '******'; $token = 'fd8144e29b4a85e9487d1cacbcd4e26c'; $repo = 'php-github-api'; $t->comment('Authenticate ' . $username); $github->authenticate($username, $token); $t->comment('Open a new issue'); $issueTitle = 'Test new issue title ' . time(); $issue = $github->getIssueApi()->open($username, $repo, $issueTitle, 'Test new issue body'); $t->is($issue['title'], $issueTitle, 'Got the new issue'); $t->is($issue['state'], 'open', 'The new issue is open'); $issueNumber = $issue['number'];