From 40bc336a12e324c717484339c3630bfb4ca08a1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20Mo=CC=88ller?= Date: Thu, 5 Mar 2015 16:45:39 +0100 Subject: [PATCH 1/2] Fix: Rename IndexController to ModuleController --- module/ZfModule/config/module.config.php | 6 +-- ...dexController.php => ModuleController.php} | 2 +- ...actory.php => ModuleControllerFactory.php} | 6 +-- ...ollerTest.php => ModuleControllerTest.php} | 46 +++++++++---------- 4 files changed, 30 insertions(+), 30 deletions(-) rename module/ZfModule/src/ZfModule/Controller/{IndexController.php => ModuleController.php} (99%) rename module/ZfModule/src/ZfModule/Controller/{IndexControllerFactory.php => ModuleControllerFactory.php} (89%) rename module/ZfModule/test/ZfModuleTest/Integration/Controller/{IndexControllerTest.php => ModuleControllerTest.php} (95%) diff --git a/module/ZfModule/config/module.config.php b/module/ZfModule/config/module.config.php index 639160b7..6bf84234 100644 --- a/module/ZfModule/config/module.config.php +++ b/module/ZfModule/config/module.config.php @@ -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, ], ], @@ -21,7 +21,7 @@ 'options' => [ 'route' => '/:vendor/:module', 'defaults' => [ - 'controller' => Controller\IndexController::class, + 'controller' => Controller\ModuleController::class, 'action' => 'view', ], ], @@ -44,7 +44,7 @@ 'options' => [ 'route' => '/module', 'defaults' => [ - 'controller' => Controller\IndexController::class, + 'controller' => Controller\ModuleController::class, 'action' => 'index', ], ], diff --git a/module/ZfModule/src/ZfModule/Controller/IndexController.php b/module/ZfModule/src/ZfModule/Controller/ModuleController.php similarity index 99% rename from module/ZfModule/src/ZfModule/Controller/IndexController.php rename to module/ZfModule/src/ZfModule/Controller/ModuleController.php index 9c644a2d..3c25ca2d 100644 --- a/module/ZfModule/src/ZfModule/Controller/IndexController.php +++ b/module/ZfModule/src/ZfModule/Controller/ModuleController.php @@ -16,7 +16,7 @@ * @method Http\Request getRequest() * @method Plugin\ZfcUserAuthentication zfcUserAuthentication() */ -class IndexController extends AbstractActionController +class ModuleController extends AbstractActionController { /** * @var Mapper\Module diff --git a/module/ZfModule/src/ZfModule/Controller/IndexControllerFactory.php b/module/ZfModule/src/ZfModule/Controller/ModuleControllerFactory.php similarity index 89% rename from module/ZfModule/src/ZfModule/Controller/IndexControllerFactory.php rename to module/ZfModule/src/ZfModule/Controller/ModuleControllerFactory.php index 9c8b2bbf..567964c5 100644 --- a/module/ZfModule/src/ZfModule/Controller/IndexControllerFactory.php +++ b/module/ZfModule/src/ZfModule/Controller/ModuleControllerFactory.php @@ -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) { @@ -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 diff --git a/module/ZfModule/test/ZfModuleTest/Integration/Controller/IndexControllerTest.php b/module/ZfModule/test/ZfModuleTest/Integration/Controller/ModuleControllerTest.php similarity index 95% rename from module/ZfModule/test/ZfModuleTest/Integration/Controller/IndexControllerTest.php rename to module/ZfModule/test/ZfModuleTest/Integration/Controller/ModuleControllerTest.php index f661445a..c1b2dcb5 100644 --- a/module/ZfModule/test/ZfModuleTest/Integration/Controller/IndexControllerTest.php +++ b/module/ZfModule/test/ZfModuleTest/Integration/Controller/ModuleControllerTest.php @@ -22,7 +22,7 @@ /** * @method Mvc\Application getApplication() */ -class IndexControllerTest extends AbstractHttpControllerTestCase +class ModuleControllerTest extends AbstractHttpControllerTestCase { use AuthenticationTrait; @@ -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); @@ -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); } @@ -151,7 +151,7 @@ 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); @@ -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); @@ -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); } @@ -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); } @@ -410,7 +410,7 @@ 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); @@ -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); @@ -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); @@ -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); @@ -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); @@ -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); @@ -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); @@ -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); @@ -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); @@ -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); @@ -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); @@ -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); @@ -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); @@ -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); } @@ -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); } @@ -1221,7 +1221,7 @@ public function testViewActionCanBeAccessed() $this->dispatch($url); - $this->assertControllerName(Controller\IndexController::class); + $this->assertControllerName(Controller\ModuleController::class); $this->assertActionName('view'); } From 286a2b64087b966c51740f18b81ce1a47bf77b82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20Mo=CC=88ller?= Date: Thu, 5 Mar 2015 16:53:45 +0100 Subject: [PATCH 2/2] Fix: Also rename view template folder --- module/ZfModule/src/ZfModule/Controller/ModuleController.php | 2 +- .../Integration/Controller/ModuleControllerTest.php | 4 ++-- module/ZfModule/view/zf-module/{index => module}/index.phtml | 0 module/ZfModule/view/zf-module/{index => module}/view.phtml | 0 4 files changed, 3 insertions(+), 3 deletions(-) rename module/ZfModule/view/zf-module/{index => module}/index.phtml (100%) rename module/ZfModule/view/zf-module/{index => module}/view.phtml (100%) diff --git a/module/ZfModule/src/ZfModule/Controller/ModuleController.php b/module/ZfModule/src/ZfModule/Controller/ModuleController.php index 3c25ca2d..d53653bb 100644 --- a/module/ZfModule/src/ZfModule/Controller/ModuleController.php +++ b/module/ZfModule/src/ZfModule/Controller/ModuleController.php @@ -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; } diff --git a/module/ZfModule/test/ZfModuleTest/Integration/Controller/ModuleControllerTest.php b/module/ZfModule/test/ZfModuleTest/Integration/Controller/ModuleControllerTest.php index c1b2dcb5..1b3ced6a 100644 --- a/module/ZfModule/test/ZfModuleTest/Integration/Controller/ModuleControllerTest.php +++ b/module/ZfModule/test/ZfModuleTest/Integration/Controller/ModuleControllerTest.php @@ -159,7 +159,7 @@ public function testIndexActionRendersUnregisteredModulesOnly() $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'); @@ -418,7 +418,7 @@ public function testOrganizationActionRendersUnregisteredModulesOnly() $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'); diff --git a/module/ZfModule/view/zf-module/index/index.phtml b/module/ZfModule/view/zf-module/module/index.phtml similarity index 100% rename from module/ZfModule/view/zf-module/index/index.phtml rename to module/ZfModule/view/zf-module/module/index.phtml diff --git a/module/ZfModule/view/zf-module/index/view.phtml b/module/ZfModule/view/zf-module/module/view.phtml similarity index 100% rename from module/ZfModule/view/zf-module/index/view.phtml rename to module/ZfModule/view/zf-module/module/view.phtml