Skip to content
This repository was archived by the owner on May 1, 2019. It is now read-only.

Commit 7b32f37

Browse files
committed
Enhancement: Add failing test
1 parent bb778f3 commit 7b32f37

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

module/ZfModule/test/ZfModuleTest/Integration/Controller/IndexControllerTest.php

+59
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,65 @@ public function testOrganizationActionFetches100MostRecentlyUpdatedRepositoriesW
228228
$this->assertResponseStatusCode(Http\Response::STATUS_CODE_200);
229229
}
230230

231+
/**
232+
* @dataProvider providerInvalidVendor
233+
* @param $vendor
234+
*/
235+
public function testOrganizationActionDoesNotMatchOnInvalidVendor($vendor)
236+
{
237+
$this->authenticatedAs(new User());
238+
239+
$repositoryCollection = $this->repositoryCollectionMock();
240+
241+
$repositoryRetriever = $this->getMockBuilder(RepositoryRetriever::class)
242+
->disableOriginalConstructor()
243+
->getMock()
244+
;
245+
246+
$repositoryRetriever
247+
->expects($this->any())
248+
->method('getUserRepositories')
249+
->with(
250+
$this->equalTo($vendor),
251+
$this->equalTo([
252+
'per_page' => 100,
253+
'sort' => 'updated',
254+
'direction' => 'desc',
255+
]
256+
))
257+
->willReturn($repositoryCollection)
258+
;
259+
260+
$this->getApplicationServiceLocator()
261+
->setAllowOverride(true)
262+
->setService(
263+
RepositoryRetriever::class,
264+
$repositoryRetriever
265+
)
266+
;
267+
268+
$url = sprintf(
269+
'/module/list/%s',
270+
$vendor
271+
);
272+
273+
$this->dispatch($url);
274+
275+
$this->assertResponseStatusCode(Http\Response::STATUS_CODE_404);
276+
}
277+
278+
/**
279+
* @return array
280+
*/
281+
public function providerInvalidVendor()
282+
{
283+
return [
284+
[
285+
'9',
286+
],
287+
];
288+
}
289+
231290
public function testOrganizationActionFetches100MostRecentlyUpdatedRepositoriesWithOwnerSpecified()
232291
{
233292
$this->authenticatedAs(new User());

0 commit comments

Comments
 (0)