Skip to content

Commit

Permalink
Run individual suites through dev/checksuite
Browse files Browse the repository at this point in the history
  • Loading branch information
chillu committed Aug 22, 2014
1 parent e77fc5c commit c1dcef9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ This module adds an API for running environment checks to your API.

* `dev/health` - A public URL that performs a quick check that this environment is functioning. This could be tied to a load balancer, for example.
* `dev/check` - An admin-only URL that performs a more comprehensive set of checks. This could be tied to a deployment system, for example.
* `dev/check/<suite>` - Check a specific suite (admin only)

## Aren't these just unit tests?

Expand Down Expand Up @@ -60,7 +61,7 @@ To add more checks, you should put additional `EnvironmentCheckSuite::register`
EnvironmentCheckSuite::register('check', 'HasFunctionCheck("curl_init")', "Does PHP have CURL support?");
EnvironmentCheckSuite::register('check', 'HasFunctionCheck("imagecreatetruecolor")', "Does PHP have GD2 support?");

The first argument is the name of the check suite. There are two built-in check suites, "health", and "check", corresponding to the `dev/health` and `dev/check` URLs. If you wish, you can create your own check suites and execute them on other URLs.
The first argument is the name of the check suite. There are two built-in check suites, "health", and "check", corresponding to the `dev/health` and `dev/check` URLs. If you wish, you can create your own check suites and execute them on other URLs. You can also add a check to more than one suite by passing the first argument as an array.

The module comes bundled with a few checks in `DefaultHealthChecks.php`. However, to test your own application, you probably want to write custom checks.

Expand Down
2 changes: 1 addition & 1 deletion _config/routes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ After: 'framework/*','cms/*'
Director:
rules:
'dev/health': 'DevHealthController'
'dev/check': 'DevCheckController'
'dev/check/$Suite': 'DevCheckController'

5 changes: 3 additions & 2 deletions code/DevCheckController.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ class DevCheckController extends Controller {
'index'
);

function index() {
$e = new EnvironmentChecker('check', 'Environment status');
function index($request) {
$suiteName = $request->param('Suite') ? $request->param('Suite') : 'check';
$e = new EnvironmentChecker($suiteName, 'Environment status');
$e->init('ADMIN'); //check for admin permissions before running this check
return $e;
}
Expand Down

0 comments on commit c1dcef9

Please sign in to comment.