mirror of
https://github.com/silverstripe/silverstripe-environmentcheck
synced 2024-10-22 17:05:40 +02:00
commit
f104ce825f
@ -12,11 +12,11 @@ This module adds an API for running environment checks to your API.
|
||||
Almost, but not really. Environment checks differ from unit tests in two important ways:
|
||||
|
||||
* **They test environment specific settings.** Unit tests are designed to use dummy data and mock interfaces to external system. Environment checks check the real systems and data that the given environment is actually connected to.
|
||||
* **They can't modify data.** Because these checks will run using production databases, they can't go modifying the data in there. This is the biggest reason why we haven't used the same base class as a unit test for writing environment checks - we wanted to make it impossible to accidentally plug the a unit test into the environment checker!
|
||||
* **They can't modify data.** Because these checks will run using production databases, they can't go modifying the data in there. This is the biggest reason why we haven't used the same base class as a unit test for writing environment checks - we wanted to make it impossible to accidentally plug a unit test into the environment checker!
|
||||
|
||||
## Adding more checks
|
||||
|
||||
To add more checks, you should put additional `EnvironmentCheckSuite::register` calls into your `_config.php`. See the `_config.php` file of this mode for examples.
|
||||
To add more checks, you should put additional `EnvironmentCheckSuite::register` calls into your `_config.php`. See the `_config.php` file of this module for examples.
|
||||
|
||||
:::php
|
||||
EnvironmentCheckSuite::register('check', 'HasFunctionCheck("curl_init")', "Does PHP have CURL support?");
|
||||
@ -60,8 +60,6 @@ Once you have created your custom check class, don't forget to register it in a
|
||||
|
||||
### Using other environment check suites
|
||||
|
||||
"health" and "check" are the only environment check suites that we use because they aren
|
||||
|
||||
If you want to use the same UI as dev/health and dev/check, you can create an `EnvironmentChecker` object. This class is a `RequestHandler` and so can be returned from an action handler. The first argument to the `EnvironmentChecker` constructor is the suite name. For example:
|
||||
|
||||
class DevHealth extends Controller {
|
||||
@ -81,4 +79,4 @@ If you wish to embed an environment check suite in another, you can use the foll
|
||||
* `$result->Status()`: The string "OK", "WARNING", or "ERROR", depending on the worst failure.
|
||||
* `$result->Details()`: A `DataObjectSet` of details about the result of each check in the suite.
|
||||
|
||||
See `EnvironmentChecker.ss` to see how these can be used to build a UI.
|
||||
See `EnvironmentChecker.ss` to see how these can be used to build a UI.
|
||||
|
Loading…
Reference in New Issue
Block a user