| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- <?php
- App::import('Lib', 'Tools.GithubLib');
- class GithubLibTestCase extends CakeTestCase {
- function setUp() {
- Configure::write('debug', 1);
- $this->GithubLib = new GithubLib();
- $this->assertTrue(is_object($this->GithubLib));
- }
- function TearDown() {
- unset($this->GithubLib);
- }
- function testFetch() {
- $url = 'http://github.com/api/v2/json/issues/list/';
- $is = $this->GithubLib->_fetch($url);
- echo returns($is);
- $this->assertFalse($is); // 401
- //$this->assertTrue(!empty($is));
- $url = 'http://github.com/api/';
- $is = $this->GithubLib->_fetch($url);
- echo returns($is);
- $this->assertFalse($is); // 404
- }
- function testUser() {
- $username = 'dereuromark';
- $is = $this->GithubLib->userInfo($username);
- echo returns($is);
- $this->assertTrue(!empty($is));
- }
- function testCommits() {
- $username = 'dereuromark';
- $project = 'tools';
- $is = $this->GithubLib->userTimeline('philsturgeon', 'codeigniter-github');
- echo returns($is);
- $this->assertTrue(!empty($is));
- }
- function testLastCommits() {
- $is = $this->GithubLib->lastCommits('philsturgeon', 'codeigniter-github');
- echo returns($is);
- $this->assertTrue(!empty($is));
- }
- function testSearch() {
- $term = 'cakephp';
- $language = 'php';
- $is = $this->GithubLib->search($term, $language);
- echo returns($is);
- $this->assertFalse($is); // WHY?
- //$this->assertTrue(!empty($is));
- }
- function testRepoInfo() {
- $user = 'dereuromark';
- $repo = 'tools';
- $is = $this->GithubLib->repoInfo($user, $repo);
- echo returns($is);
- $this->assertTrue(!empty($is));
- }
- function testRepoRefs() {
- $user = 'dereuromark';
- $repo = 'tools';
- $is = $this->GithubLib->repoRefs($user, $repo);
- echo returns($is);
- $this->assertTrue(empty($is));
- $is = $this->GithubLib->repoRefs($user, $repo, 'branches');
- echo returns($is);
- $this->assertTrue(!empty($is));
- }
- function testProjectIssues() {
- $user = 'dereuromark';
- $repo = 'tools';
- $is = $this->GithubLib->projectIssues($user, $repo);
- echo returns($is);
- $this->assertFalse($is);
- }
- }
- ?>
|