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

Fix: Assert route names #478

Merged
merged 1 commit into from
Apr 27, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ public function testContributorsActionCanBeAccessed()

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

$this->assertMatchedRouteName('contributors');

$this->assertControllerName(Controller\ContributorsController::class);
$this->assertActionName('index');
$this->assertResponseStatusCode(Http\Response::STATUS_CODE_200);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ public function testIndexActionCanBeAccessed()

$this->dispatch('/');

$this->assertMatchedRouteName('home');

$this->assertControllerName(Controller\IndexController::class);
$this->assertActionName('index');
$this->assertResponseStatusCode(Http\Response::STATUS_CODE_200);
Expand Down Expand Up @@ -101,6 +103,8 @@ public function testFeedActionCanBeAccessed()

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

$this->assertMatchedRouteName('feed');

$this->assertControllerName(Controller\IndexController::class);
$this->assertActionName('feed');
$this->assertResponseStatusCode(Http\Response::STATUS_CODE_200);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ public function testIndexActionCanBeAccessed()

$this->dispatch('/live-search');

$this->assertMatchedRouteName('live-search');

$this->assertControllerName(Controller\SearchController::class);
$this->assertActionName('index');
$this->assertResponseStatusCode(Http\Response::STATUS_CODE_200);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ public function testIndexActionRedirectsIfNotAuthenticated()

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

$this->assertMatchedRouteName('scn-social-auth-user');

$this->assertControllerName('zfcuser');
$this->assertActionName('index');
$this->assertResponseStatusCode(Http\Response::STATUS_CODE_302);
Expand Down Expand Up @@ -103,6 +105,8 @@ public function testIndexActionSetsModulesIfAuthenticated()

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

$this->assertMatchedRouteName('scn-social-auth-user');

$this->assertControllerName('zfcuser');
$this->assertActionName('index');
$this->assertResponseStatusCode(Http\Response::STATUS_CODE_200);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ public function testIndexActionRedirectsIfNotAuthenticated()

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

$this->assertMatchedRouteName('zf-module');

$this->assertControllerName(Controller\ModuleController::class);
$this->assertActionName('index');
$this->assertResponseStatusCode(Http\Response::STATUS_CODE_302);
Expand Down Expand Up @@ -79,6 +81,8 @@ public function testIndexActionFetches100MostRecentlyUpdatedUserRepositories()

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

$this->assertMatchedRouteName('zf-module');

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

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

$this->assertMatchedRouteName('zf-module');

$this->assertControllerName(Controller\ModuleController::class);
$this->assertActionName('index');
$this->assertResponseStatusCode(Http\Response::STATUS_CODE_200);
Expand Down Expand Up @@ -181,6 +187,8 @@ public function testListActionRedirectsIfNotAuthenticated()

$this->dispatch($url);

$this->assertMatchedRouteName('zf-module/list');

$this->assertControllerName(Controller\ModuleController::class);
$this->assertActionName('list');
$this->assertResponseStatusCode(Http\Response::STATUS_CODE_302);
Expand Down Expand Up @@ -223,6 +231,8 @@ public function testListActionFetches100MostRecentlyUpdatedRepositoriesWhenNoOwn

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

$this->assertMatchedRouteName('zf-module/list');

$this->assertControllerName(Controller\ModuleController::class);
$this->assertActionName('list');
$this->assertResponseStatusCode(Http\Response::STATUS_CODE_200);
Expand Down Expand Up @@ -331,6 +341,8 @@ public function testListActionFetches100MostRecentlyUpdatedRepositoriesWithOwner

$this->dispatch($url);

$this->assertMatchedRouteName('zf-module/list');

$this->assertControllerName(Controller\ModuleController::class);
$this->assertActionName('list');
$this->assertResponseStatusCode(Http\Response::STATUS_CODE_200);
Expand Down Expand Up @@ -410,11 +422,12 @@ public function testListActionRendersUnregisteredModulesOnly()

$this->dispatch($url);

$this->assertMatchedRouteName('zf-module/list');

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

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

$this->assertTrue($viewModel->terminate());
Expand All @@ -433,6 +446,8 @@ public function testAddActionRedirectsIfNotAuthenticated()

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

$this->assertMatchedRouteName('zf-module/add');

$this->assertControllerName(Controller\ModuleController::class);
$this->assertActionName('add');
$this->assertResponseStatusCode(Http\Response::STATUS_CODE_302);
Expand All @@ -454,6 +469,8 @@ public function testAddActionThrowsUnexpectedValueExceptionIfNotPostedTo($method
$method
);

$this->assertMatchedRouteName('zf-module/add');

$this->assertControllerName(Controller\ModuleController::class);
$this->assertActionName('add');
$this->assertResponseStatusCode(Http\Response::STATUS_CODE_500);
Expand Down Expand Up @@ -525,6 +542,8 @@ public function testAddActionThrowsRuntimeExceptionIfUnableToFetchRepositoryMeta
]
);

$this->assertMatchedRouteName('zf-module/add');

$this->assertControllerName(Controller\ModuleController::class);
$this->assertActionName('add');
$this->assertResponseStatusCode(Http\Response::STATUS_CODE_500);
Expand Down Expand Up @@ -586,6 +605,8 @@ public function testAddActionThrowsUnexpectedValueExceptionWhenRepositoryHasInsu
]
);

$this->assertMatchedRouteName('zf-module/add');

$this->assertControllerName(Controller\ModuleController::class);
$this->assertActionName('add');
$this->assertResponseStatusCode(Http\Response::STATUS_CODE_500);
Expand Down Expand Up @@ -675,6 +696,8 @@ public function testAddActionThrowsUnexpectedValueExceptionWhenRepositoryIsNotAM
]
);

$this->assertMatchedRouteName('zf-module/add');

$this->assertControllerName(Controller\ModuleController::class);
$this->assertActionName('add');
$this->assertResponseStatusCode(Http\Response::STATUS_CODE_500);
Expand Down Expand Up @@ -759,6 +782,8 @@ public function testAddActionRegistersRepositoryIfPermissionsAreSufficientAndItI
]
);

$this->assertMatchedRouteName('zf-module/add');

$this->assertControllerName(Controller\ModuleController::class);
$this->assertActionName('add');
$this->assertResponseStatusCode(Http\Response::STATUS_CODE_302);
Expand All @@ -772,6 +797,8 @@ public function testRemoveActionRedirectsIfNotAuthenticated()

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

$this->assertMatchedRouteName('zf-module/remove');

$this->assertControllerName(Controller\ModuleController::class);
$this->assertActionName('remove');
$this->assertResponseStatusCode(Http\Response::STATUS_CODE_302);
Expand All @@ -793,6 +820,8 @@ public function testRemoveActionThrowsUnexpectedValueExceptionIfNotPostedTo($met
$method
);

$this->assertMatchedRouteName('zf-module/remove');

$this->assertControllerName(Controller\ModuleController::class);
$this->assertActionName('remove');
$this->assertResponseStatusCode(Http\Response::STATUS_CODE_500);
Expand Down Expand Up @@ -846,6 +875,8 @@ public function testRemoveActionThrowsRuntimeExceptionIfUnableToFetchRepositoryM
]
);

$this->assertMatchedRouteName('zf-module/remove');

$this->assertControllerName(Controller\ModuleController::class);
$this->assertActionName('remove');
$this->assertResponseStatusCode(Http\Response::STATUS_CODE_500);
Expand Down Expand Up @@ -907,6 +938,8 @@ public function testRemoveActionThrowsUnexpectedValueExceptionWhenRepositoryHasI
]
);

$this->assertMatchedRouteName('zf-module/remove');

$this->assertControllerName(Controller\ModuleController::class);
$this->assertActionName('remove');
$this->assertResponseStatusCode(Http\Response::STATUS_CODE_500);
Expand Down Expand Up @@ -982,6 +1015,8 @@ public function testRemoveActionThrowsUnexpectedValueExceptionWhenRepositoryNotP
]
);

$this->assertMatchedRouteName('zf-module/remove');

$this->assertControllerName(Controller\ModuleController::class);
$this->assertActionName('remove');
$this->assertResponseStatusCode(Http\Response::STATUS_CODE_500);
Expand Down Expand Up @@ -1067,6 +1102,8 @@ public function testRemoveActionDeletesModuleIfPermissionsAreSufficientAndItHasB
]
);

$this->assertMatchedRouteName('zf-module/remove');

$this->assertControllerName(Controller\ModuleController::class);
$this->assertActionName('remove');
$this->assertResponseStatusCode(Http\Response::STATUS_CODE_302);
Expand Down Expand Up @@ -1107,6 +1144,8 @@ public function testViewActionSetsHttp404ResponseCodeIfModuleNotFound()

$this->dispatch($url);

$this->assertMatchedRouteName('view-module');

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

$this->dispatch($url);

$this->assertMatchedRouteName('view-module');

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

$this->dispatch($url);

$this->assertMatchedRouteName('view-module');

$this->assertControllerName(Controller\ModuleController::class);
$this->assertActionName('view');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ public function testUserPageCanBeAccessed()

$this->dispatch($url);

$this->assertMatchedRouteName('modules-for-user');

$this->assertControllerName(Controller\UserController::class);
$this->assertActionName('modulesForUser');
$this->assertResponseStatusCode(Http\Response::STATUS_CODE_200);
Expand Down