Skip to content

Commit 711e8a6

Browse files
committed
Don't use external mock object
1 parent 4228ae5 commit 711e8a6

2 files changed

Lines changed: 31 additions & 25 deletions

File tree

Tests/GithubObjectTest.php

Lines changed: 31 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
use Joomla\Github\AbstractGithubObject;
1010
use Joomla\Github\Tests\Stub\GitHubTestCase;
1111
use Joomla\Github\Tests\Stub\ObjectMock;
12-
use Joomla\Github\Tests\Stub\TransportMock;
1312
use Joomla\Http\Http;
1413

1514
/**
@@ -43,7 +42,8 @@ protected function setUp()
4342
{
4443
parent::setUp();
4544

46-
$this->client = new Http(array(), new TransportMock());
45+
$transport = $this->createMock('\Joomla\Http\TransportInterface');
46+
$this->client = new Http(array(), $transport);
4747
$this->object = new ObjectMock($this->options, $this->client);
4848
}
4949

@@ -57,10 +57,34 @@ protected function setUp()
5757
public function fetchUrlData()
5858
{
5959
return array(
60-
'Standard github - no pagination data' => array('https://api.github.com', '/gists', 0, 0, 'https://api.github.com/gists'),
61-
'Enterprise github - no pagination data' => array('https://mygithub.com', '/gists', 0, 0, 'https://mygithub.com/gists'),
62-
'Standard github - page 3' => array('https://api.github.com', '/gists', 3, 0, 'https://api.github.com/gists?page=3'),
63-
'Enterprise github - page 3, 50 per page' => array('https://mygithub.com', '/gists', 3, 50, 'https://mygithub.com/gists?page=3&per_page=50'),
60+
'Standard github - no pagination data' => array(
61+
'https://api.github.com',
62+
'/gists',
63+
0,
64+
0,
65+
'https://api.github.com/gists'
66+
),
67+
'Enterprise github - no pagination data' => array(
68+
'https://mygithub.com',
69+
'/gists',
70+
0,
71+
0,
72+
'https://mygithub.com/gists'
73+
),
74+
'Standard github - page 3' => array(
75+
'https://api.github.com',
76+
'/gists',
77+
3,
78+
0,
79+
'https://api.github.com/gists?page=3'
80+
),
81+
'Enterprise github - page 3, 50 per page' => array(
82+
'https://mygithub.com',
83+
'/gists',
84+
3,
85+
50,
86+
'https://mygithub.com/gists?page=3&per_page=50'
87+
),
6488
);
6589
}
6690

@@ -121,14 +145,12 @@ public function testFetchUrlToken()
121145

122146
$this->options->set('gh.token', 'MyTestToken');
123147

124-
$options = clone $this->options;
125-
126148
self::assertEquals(
127149
'https://api.github.com/gists',
128150
$this->object->fetchUrl('/gists', 0, 0),
129151
'URL is not as expected.'
130152
);
131-
153+
132154
self::assertEquals(
133155
array('Authorization' => 'token MyTestToken'),
134156
$this->client->getOption('headers'),

Tests/Stub/TransportMock.php

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)