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

Commit

Permalink
Merge pull request #353 from gianarb/feature/fetch-repos
Browse files Browse the repository at this point in the history
List of repositories from Github
  • Loading branch information
Ocramius committed Mar 4, 2015
2 parents 00931f7 + fa9e0e4 commit 3e3c202
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 43 deletions.
4 changes: 0 additions & 4 deletions module/ZfModule/src/ZfModule/Controller/IndexController.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,6 @@ private function unregisteredRepositories(RepositoryCollection $repositories)
return false;
}

if (!$this->moduleService->isModule($repository)) {
return false;
}

if ($this->moduleMapper->findByName($repository->name)) {
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,21 +84,18 @@ public function testIndexActionFetches100MostRecentlyUpdatedUserRepositories()
$this->assertResponseStatusCode(Http\Response::STATUS_CODE_200);
}

public function testIndexActionRendersValidModulesOnly()
public function testIndexActionRendersUnregisteredModulesOnly()
{
$this->authenticatedAs(new User());

$validModule = $this->validModule();

$nonModule = $this->nonModule();
$unregisteredModule = $this->validModule();
$registeredModule = $this->registeredModule();

$repositories = [
$validModule,
$nonModule,
$unregisteredModule,
$registeredModule,
$this->forkedModule(),
$this->moduleWithoutPushPermissions(),
$this->forkedModule(),
];

$repositoryCollection = $this->repositoryCollectionMock($repositories);
Expand All @@ -119,18 +116,6 @@ public function testIndexActionRendersValidModulesOnly()
->getMock()
;

$moduleService
->expects($this->any())
->method('isModule')
->willReturnCallback(function ($repository) use ($nonModule) {
if ($repository !== $nonModule) {
return true;
}

return false;
})
;

$moduleMapper = $this->getMockBuilder(Mapper\Module::class)
->disableOriginalConstructor()
->getMock()
Expand Down Expand Up @@ -180,7 +165,7 @@ public function testIndexActionRendersValidModulesOnly()

$this->assertInternalType('array', $viewVariable);
$this->assertCount(1, $viewVariable);
$this->assertSame($validModule, $viewVariable[0]);
$this->assertSame($unregisteredModule, $viewVariable[0]);
}

public function testOrganizationActionRedirectsIfNotAuthenticated()
Expand Down Expand Up @@ -290,18 +275,15 @@ public function testOrganizationActionFetches100MostRecentlyUpdatedRepositoriesW
$this->assertResponseStatusCode(Http\Response::STATUS_CODE_200);
}

public function testOrganizationActionRendersValidModulesOnly()
public function testOrganizationActionRendersUnregisteredModulesOnly()
{
$this->authenticatedAs(new User());

$validModule = $this->validModule();

$nonModule = $this->nonModule();
$unregisteredModule = $this->validModule();
$registeredModule = $this->registeredModule();

$repositories = [
$validModule,
$nonModule,
$unregisteredModule,
$registeredModule,
$this->forkedModule(),
$this->moduleWithoutPushPermissions(),
Expand All @@ -327,18 +309,6 @@ public function testOrganizationActionRendersValidModulesOnly()
->getMock()
;

$moduleService
->expects($this->any())
->method('isModule')
->willReturnCallback(function ($repository) use ($nonModule) {
if ($repository !== $nonModule) {
return true;
}

return false;
})
;

$moduleMapper = $this->getMockBuilder(Mapper\Module::class)
->disableOriginalConstructor()
->getMock()
Expand Down Expand Up @@ -393,7 +363,7 @@ public function testOrganizationActionRendersValidModulesOnly()

$this->assertInternalType('array', $viewVariable);
$this->assertCount(1, $viewVariable);
$this->assertSame($validModule, $viewVariable[0]);
$this->assertSame($unregisteredModule, $viewVariable[0]);
}

public function testAddActionRedirectsIfNotAuthenticated()
Expand Down

0 comments on commit 3e3c202

Please sign in to comment.