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

Commit 95c7c5c

Browse files
committed
Merge pull request #470 from localheinz/fix/index-vs-module
Fix: Rename IndexController to ModuleController
2 parents ad5283f + 286a2b6 commit 95c7c5c

File tree

6 files changed

+33
-33
lines changed

6 files changed

+33
-33
lines changed

module/ZfModule/config/module.config.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
return [
1111
'controllers' => [
1212
'factories' => [
13-
Controller\IndexController::class => Controller\IndexControllerFactory::class,
13+
Controller\ModuleController::class => Controller\ModuleControllerFactory::class,
1414
Controller\UserController::class => Controller\UserControllerFactory::class,
1515
],
1616
],
@@ -21,7 +21,7 @@
2121
'options' => [
2222
'route' => '/:vendor/:module',
2323
'defaults' => [
24-
'controller' => Controller\IndexController::class,
24+
'controller' => Controller\ModuleController::class,
2525
'action' => 'view',
2626
],
2727
],
@@ -44,7 +44,7 @@
4444
'options' => [
4545
'route' => '/module',
4646
'defaults' => [
47-
'controller' => Controller\IndexController::class,
47+
'controller' => Controller\ModuleController::class,
4848
'action' => 'index',
4949
],
5050
],

module/ZfModule/src/ZfModule/Controller/IndexController.php renamed to module/ZfModule/src/ZfModule/Controller/ModuleController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* @method Http\Request getRequest()
1717
* @method Plugin\ZfcUserAuthentication zfcUserAuthentication()
1818
*/
19-
class IndexController extends AbstractActionController
19+
class ModuleController extends AbstractActionController
2020
{
2121
/**
2222
* @var Mapper\Module
@@ -116,7 +116,7 @@ public function organizationAction()
116116

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

121121
return $viewModel;
122122
}

module/ZfModule/src/ZfModule/Controller/IndexControllerFactory.php renamed to module/ZfModule/src/ZfModule/Controller/ModuleControllerFactory.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
use ZfModule\Mapper;
1010
use ZfModule\Service;
1111

12-
class IndexControllerFactory implements FactoryInterface
12+
class ModuleControllerFactory implements FactoryInterface
1313
{
1414
/**
1515
* @param ServiceLocatorInterface $controllerManager
16-
* @return IndexController
16+
* @return ModuleController
1717
*/
1818
public function createService(ServiceLocatorInterface $controllerManager)
1919
{
@@ -29,7 +29,7 @@ public function createService(ServiceLocatorInterface $controllerManager)
2929
/* @var RepositoryRetriever $repositoryRetriever */
3030
$repositoryRetriever = $serviceManager->get(RepositoryRetriever::class);
3131

32-
return new IndexController(
32+
return new ModuleController(
3333
$moduleMapper,
3434
$moduleService,
3535
$repositoryRetriever

module/ZfModule/test/ZfModuleTest/Integration/Controller/IndexControllerTest.php renamed to module/ZfModule/test/ZfModuleTest/Integration/Controller/ModuleControllerTest.php

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
/**
2323
* @method Mvc\Application getApplication()
2424
*/
25-
class IndexControllerTest extends AbstractHttpControllerTestCase
25+
class ModuleControllerTest extends AbstractHttpControllerTestCase
2626
{
2727
use AuthenticationTrait;
2828

@@ -39,7 +39,7 @@ public function testIndexActionRedirectsIfNotAuthenticated()
3939

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

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

@@ -79,7 +79,7 @@ public function testIndexActionFetches100MostRecentlyUpdatedUserRepositories()
7979

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

82-
$this->assertControllerName(Controller\IndexController::class);
82+
$this->assertControllerName(Controller\ModuleController::class);
8383
$this->assertActionName('index');
8484
$this->assertResponseStatusCode(Http\Response::STATUS_CODE_200);
8585
}
@@ -151,15 +151,15 @@ public function testIndexActionRendersUnregisteredModulesOnly()
151151

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

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

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

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

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

@@ -181,7 +181,7 @@ public function testOrganizationActionRedirectsIfNotAuthenticated()
181181

182182
$this->dispatch($url);
183183

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

@@ -223,7 +223,7 @@ public function testOrganizationActionFetches100MostRecentlyUpdatedRepositoriesW
223223

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

226-
$this->assertControllerName(Controller\IndexController::class);
226+
$this->assertControllerName(Controller\ModuleController::class);
227227
$this->assertActionName('organization');
228228
$this->assertResponseStatusCode(Http\Response::STATUS_CODE_200);
229229
}
@@ -331,7 +331,7 @@ public function testOrganizationActionFetches100MostRecentlyUpdatedRepositoriesW
331331

332332
$this->dispatch($url);
333333

334-
$this->assertControllerName(Controller\IndexController::class);
334+
$this->assertControllerName(Controller\ModuleController::class);
335335
$this->assertActionName('organization');
336336
$this->assertResponseStatusCode(Http\Response::STATUS_CODE_200);
337337
}
@@ -410,15 +410,15 @@ public function testOrganizationActionRendersUnregisteredModulesOnly()
410410

411411
$this->dispatch($url);
412412

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

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

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

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

@@ -433,7 +433,7 @@ public function testAddActionRedirectsIfNotAuthenticated()
433433

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

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

@@ -454,7 +454,7 @@ public function testAddActionThrowsUnexpectedValueExceptionIfNotPostedTo($method
454454
$method
455455
);
456456

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

@@ -525,7 +525,7 @@ public function testAddActionThrowsRuntimeExceptionIfUnableToFetchRepositoryMeta
525525
]
526526
);
527527

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

@@ -586,7 +586,7 @@ public function testAddActionThrowsUnexpectedValueExceptionWhenRepositoryHasInsu
586586
]
587587
);
588588

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

@@ -675,7 +675,7 @@ public function testAddActionThrowsUnexpectedValueExceptionWhenRepositoryIsNotAM
675675
]
676676
);
677677

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

@@ -759,7 +759,7 @@ public function testAddActionRegistersRepositoryIfPermissionsAreSufficientAndItI
759759
]
760760
);
761761

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

@@ -772,7 +772,7 @@ public function testRemoveActionRedirectsIfNotAuthenticated()
772772

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

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

@@ -793,7 +793,7 @@ public function testRemoveActionThrowsUnexpectedValueExceptionIfNotPostedTo($met
793793
$method
794794
);
795795

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

@@ -846,7 +846,7 @@ public function testRemoveActionThrowsRuntimeExceptionIfUnableToFetchRepositoryM
846846
]
847847
);
848848

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

@@ -907,7 +907,7 @@ public function testRemoveActionThrowsUnexpectedValueExceptionWhenRepositoryHasI
907907
]
908908
);
909909

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

@@ -982,7 +982,7 @@ public function testRemoveActionThrowsUnexpectedValueExceptionWhenRepositoryNotP
982982
]
983983
);
984984

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

@@ -1067,7 +1067,7 @@ public function testRemoveActionDeletesModuleIfPermissionsAreSufficientAndItHasB
10671067
]
10681068
);
10691069

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

@@ -1107,7 +1107,7 @@ public function testViewActionSetsHttp404ResponseCodeIfModuleNotFound()
11071107

11081108
$this->dispatch($url);
11091109

1110-
$this->assertControllerName(Controller\IndexController::class);
1110+
$this->assertControllerName(Controller\ModuleController::class);
11111111
$this->assertActionName('not-found');
11121112
$this->assertResponseStatusCode(Http\Response::STATUS_CODE_404);
11131113
}
@@ -1164,7 +1164,7 @@ public function testViewActionSetsHttp404ResponseCodeIfRepositoryMetaDataNotFoun
11641164

11651165
$this->dispatch($url);
11661166

1167-
$this->assertControllerName(Controller\IndexController::class);
1167+
$this->assertControllerName(Controller\ModuleController::class);
11681168
$this->assertActionName('not-found');
11691169
$this->assertResponseStatusCode(Http\Response::STATUS_CODE_404);
11701170
}
@@ -1221,7 +1221,7 @@ public function testViewActionCanBeAccessed()
12211221

12221222
$this->dispatch($url);
12231223

1224-
$this->assertControllerName(Controller\IndexController::class);
1224+
$this->assertControllerName(Controller\ModuleController::class);
12251225
$this->assertActionName('view');
12261226
}
12271227

File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)