forked from ornicar/php-github-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapiTest.php
More file actions
executable file
·38 lines (25 loc) · 1.1 KB
/
Copy pathapiTest.php
File metadata and controls
executable file
·38 lines (25 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
require_once dirname(__FILE__).'/vendor/lime.php';
require_once dirname(__FILE__).'/../lib/phpGitHubApi.php';
require_once dirname(__FILE__).'/../lib/request/phpGitHubApiRequest.php';
$t = new lime_test(6);
$t->comment('Low level request');
$request = new phpGitHubApiRequest();
$t->isa_ok($request, 'phpGitHubApiRequest', 'Got a phpGitHubApiRequest instance');
$users = $request->get('user/search/diem-project');
$t->is(count($users['users']), 1, 'Found one user');
$t->is(array_keys($users['users']), array('diem-project'), 'Found diem-project user');
$t->comment('Low level API');
$github = new phpGitHubApi();
$t->isa_ok($github, 'phpGitHubApi', 'Got a phpGitHubApi instance');
$repo = $github->get('repos/show/ornicar/php-github-api');
$t->is($repo['repository']['name'], 'php-github-api', 'Found information about php-github-api repo');
try
{
$github->get('non-existing-url/for-sure');
$t->fail('Call to non-existing-url/for-sure throws a phpGitHubApiRequestException');
}
catch(phpGitHubApiRequestException $e)
{
$t->pass('Call to non-existing-url/for-sure throws a phpGitHubApiRequestException');
}