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 #470 from localheinz/fix/index-vs-module
Browse files Browse the repository at this point in the history
Fix: Rename IndexController to ModuleController
  • Loading branch information
Ocramius committed Mar 6, 2015
2 parents ad5283f + 286a2b6 commit 95c7c5c
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 33 deletions.
6 changes: 3 additions & 3 deletions module/ZfModule/config/module.config.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
return [
'controllers' => [
'factories' => [
Controller\IndexController::class => Controller\IndexControllerFactory::class,
Controller\ModuleController::class => Controller\ModuleControllerFactory::class,
Controller\UserController::class => Controller\UserControllerFactory::class,
],
],
Expand All @@ -21,7 +21,7 @@
'options' => [
'route' => '/:vendor/:module',
'defaults' => [
'controller' => Controller\IndexController::class,
'controller' => Controller\ModuleController::class,
'action' => 'view',
],
],
Expand All @@ -44,7 +44,7 @@
'options' => [
'route' => '/module',
'defaults' => [
'controller' => Controller\IndexController::class,
'controller' => Controller\ModuleController::class,
'action' => 'index',
],
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* @method Http\Request getRequest()
* @method Plugin\ZfcUserAuthentication zfcUserAuthentication()
*/
class IndexController extends AbstractActionController
class ModuleController extends AbstractActionController
{
/**
* @var Mapper\Module
Expand Down Expand Up @@ -116,7 +116,7 @@ public function organizationAction()

$viewModel = new ViewModel(['repositories' => $repositories]);
$viewModel->setTerminal(true);
$viewModel->setTemplate('zf-module/index/index.phtml');
$viewModel->setTemplate('zf-module/module/index.phtml');

return $viewModel;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
use ZfModule\Mapper;
use ZfModule\Service;

class IndexControllerFactory implements FactoryInterface
class ModuleControllerFactory implements FactoryInterface
{
/**
* @param ServiceLocatorInterface $controllerManager
* @return IndexController
* @return ModuleController
*/
public function createService(ServiceLocatorInterface $controllerManager)
{
Expand All @@ -29,7 +29,7 @@ public function createService(ServiceLocatorInterface $controllerManager)
/* @var RepositoryRetriever $repositoryRetriever */
$repositoryRetriever = $serviceManager->get(RepositoryRetriever::class);

return new IndexController(
return new ModuleController(
$moduleMapper,
$moduleService,
$repositoryRetriever
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
/**
* @method Mvc\Application getApplication()
*/
class IndexControllerTest extends AbstractHttpControllerTestCase
class ModuleControllerTest extends AbstractHttpControllerTestCase
{
use AuthenticationTrait;

Expand All @@ -39,7 +39,7 @@ public function testIndexActionRedirectsIfNotAuthenticated()

$this->dispatch('/module');

$this->assertControllerName(Controller\IndexController::class);
$this->assertControllerName(Controller\ModuleController::class);
$this->assertActionName('index');
$this->assertResponseStatusCode(Http\Response::STATUS_CODE_302);

Expand Down Expand Up @@ -79,7 +79,7 @@ public function testIndexActionFetches100MostRecentlyUpdatedUserRepositories()

$this->dispatch('/module');

$this->assertControllerName(Controller\IndexController::class);
$this->assertControllerName(Controller\ModuleController::class);
$this->assertActionName('index');
$this->assertResponseStatusCode(Http\Response::STATUS_CODE_200);
}
Expand Down Expand Up @@ -151,15 +151,15 @@ public function testIndexActionRendersUnregisteredModulesOnly()

$this->dispatch('/module');

$this->assertControllerName(Controller\IndexController::class);
$this->assertControllerName(Controller\ModuleController::class);
$this->assertActionName('index');
$this->assertResponseStatusCode(Http\Response::STATUS_CODE_200);

/* @var Mvc\Application $application */
$viewModel = $this->getApplication()->getMvcEvent()->getViewModel();

$this->assertTrue($viewModel->terminate());
$this->assertSame('zf-module/index/index', $viewModel->getTemplate());
$this->assertSame('zf-module/module/index', $viewModel->getTemplate());

$viewVariable = $viewModel->getVariable('repositories');

Expand All @@ -181,7 +181,7 @@ public function testOrganizationActionRedirectsIfNotAuthenticated()

$this->dispatch($url);

$this->assertControllerName(Controller\IndexController::class);
$this->assertControllerName(Controller\ModuleController::class);
$this->assertActionName('organization');
$this->assertResponseStatusCode(Http\Response::STATUS_CODE_302);

Expand Down Expand Up @@ -223,7 +223,7 @@ public function testOrganizationActionFetches100MostRecentlyUpdatedRepositoriesW

$this->dispatch('/module/list');

$this->assertControllerName(Controller\IndexController::class);
$this->assertControllerName(Controller\ModuleController::class);
$this->assertActionName('organization');
$this->assertResponseStatusCode(Http\Response::STATUS_CODE_200);
}
Expand Down Expand Up @@ -331,7 +331,7 @@ public function testOrganizationActionFetches100MostRecentlyUpdatedRepositoriesW

$this->dispatch($url);

$this->assertControllerName(Controller\IndexController::class);
$this->assertControllerName(Controller\ModuleController::class);
$this->assertActionName('organization');
$this->assertResponseStatusCode(Http\Response::STATUS_CODE_200);
}
Expand Down Expand Up @@ -410,15 +410,15 @@ public function testOrganizationActionRendersUnregisteredModulesOnly()

$this->dispatch($url);

$this->assertControllerName(Controller\IndexController::class);
$this->assertControllerName(Controller\ModuleController::class);
$this->assertActionName('organization');
$this->assertResponseStatusCode(Http\Response::STATUS_CODE_200);

/* @var Mvc\Application $application */
$viewModel = $this->getApplication()->getMvcEvent()->getViewModel();

$this->assertTrue($viewModel->terminate());
$this->assertSame('zf-module/index/index.phtml', $viewModel->getTemplate());
$this->assertSame('zf-module/module/index.phtml', $viewModel->getTemplate());

$viewVariable = $viewModel->getVariable('repositories');

Expand All @@ -433,7 +433,7 @@ public function testAddActionRedirectsIfNotAuthenticated()

$this->dispatch('/module/add');

$this->assertControllerName(Controller\IndexController::class);
$this->assertControllerName(Controller\ModuleController::class);
$this->assertActionName('add');
$this->assertResponseStatusCode(Http\Response::STATUS_CODE_302);

Expand All @@ -454,7 +454,7 @@ public function testAddActionThrowsUnexpectedValueExceptionIfNotPostedTo($method
$method
);

$this->assertControllerName(Controller\IndexController::class);
$this->assertControllerName(Controller\ModuleController::class);
$this->assertActionName('add');
$this->assertResponseStatusCode(Http\Response::STATUS_CODE_500);

Expand Down Expand Up @@ -525,7 +525,7 @@ public function testAddActionThrowsRuntimeExceptionIfUnableToFetchRepositoryMeta
]
);

$this->assertControllerName(Controller\IndexController::class);
$this->assertControllerName(Controller\ModuleController::class);
$this->assertActionName('add');
$this->assertResponseStatusCode(Http\Response::STATUS_CODE_500);

Expand Down Expand Up @@ -586,7 +586,7 @@ public function testAddActionThrowsUnexpectedValueExceptionWhenRepositoryHasInsu
]
);

$this->assertControllerName(Controller\IndexController::class);
$this->assertControllerName(Controller\ModuleController::class);
$this->assertActionName('add');
$this->assertResponseStatusCode(Http\Response::STATUS_CODE_500);

Expand Down Expand Up @@ -675,7 +675,7 @@ public function testAddActionThrowsUnexpectedValueExceptionWhenRepositoryIsNotAM
]
);

$this->assertControllerName(Controller\IndexController::class);
$this->assertControllerName(Controller\ModuleController::class);
$this->assertActionName('add');
$this->assertResponseStatusCode(Http\Response::STATUS_CODE_500);

Expand Down Expand Up @@ -759,7 +759,7 @@ public function testAddActionRegistersRepositoryIfPermissionsAreSufficientAndItI
]
);

$this->assertControllerName(Controller\IndexController::class);
$this->assertControllerName(Controller\ModuleController::class);
$this->assertActionName('add');
$this->assertResponseStatusCode(Http\Response::STATUS_CODE_302);

Expand All @@ -772,7 +772,7 @@ public function testRemoveActionRedirectsIfNotAuthenticated()

$this->dispatch('/module/remove');

$this->assertControllerName(Controller\IndexController::class);
$this->assertControllerName(Controller\ModuleController::class);
$this->assertActionName('remove');
$this->assertResponseStatusCode(Http\Response::STATUS_CODE_302);

Expand All @@ -793,7 +793,7 @@ public function testRemoveActionThrowsUnexpectedValueExceptionIfNotPostedTo($met
$method
);

$this->assertControllerName(Controller\IndexController::class);
$this->assertControllerName(Controller\ModuleController::class);
$this->assertActionName('remove');
$this->assertResponseStatusCode(Http\Response::STATUS_CODE_500);

Expand Down Expand Up @@ -846,7 +846,7 @@ public function testRemoveActionThrowsRuntimeExceptionIfUnableToFetchRepositoryM
]
);

$this->assertControllerName(Controller\IndexController::class);
$this->assertControllerName(Controller\ModuleController::class);
$this->assertActionName('remove');
$this->assertResponseStatusCode(Http\Response::STATUS_CODE_500);

Expand Down Expand Up @@ -907,7 +907,7 @@ public function testRemoveActionThrowsUnexpectedValueExceptionWhenRepositoryHasI
]
);

$this->assertControllerName(Controller\IndexController::class);
$this->assertControllerName(Controller\ModuleController::class);
$this->assertActionName('remove');
$this->assertResponseStatusCode(Http\Response::STATUS_CODE_500);

Expand Down Expand Up @@ -982,7 +982,7 @@ public function testRemoveActionThrowsUnexpectedValueExceptionWhenRepositoryNotP
]
);

$this->assertControllerName(Controller\IndexController::class);
$this->assertControllerName(Controller\ModuleController::class);
$this->assertActionName('remove');
$this->assertResponseStatusCode(Http\Response::STATUS_CODE_500);

Expand Down Expand Up @@ -1067,7 +1067,7 @@ public function testRemoveActionDeletesModuleIfPermissionsAreSufficientAndItHasB
]
);

$this->assertControllerName(Controller\IndexController::class);
$this->assertControllerName(Controller\ModuleController::class);
$this->assertActionName('remove');
$this->assertResponseStatusCode(Http\Response::STATUS_CODE_302);

Expand Down Expand Up @@ -1107,7 +1107,7 @@ public function testViewActionSetsHttp404ResponseCodeIfModuleNotFound()

$this->dispatch($url);

$this->assertControllerName(Controller\IndexController::class);
$this->assertControllerName(Controller\ModuleController::class);
$this->assertActionName('not-found');
$this->assertResponseStatusCode(Http\Response::STATUS_CODE_404);
}
Expand Down Expand Up @@ -1164,7 +1164,7 @@ public function testViewActionSetsHttp404ResponseCodeIfRepositoryMetaDataNotFoun

$this->dispatch($url);

$this->assertControllerName(Controller\IndexController::class);
$this->assertControllerName(Controller\ModuleController::class);
$this->assertActionName('not-found');
$this->assertResponseStatusCode(Http\Response::STATUS_CODE_404);
}
Expand Down Expand Up @@ -1221,7 +1221,7 @@ public function testViewActionCanBeAccessed()

$this->dispatch($url);

$this->assertControllerName(Controller\IndexController::class);
$this->assertControllerName(Controller\ModuleController::class);
$this->assertActionName('view');
}

Expand Down

0 comments on commit 95c7c5c

Please sign in to comment.