# wp-self-test: REST routes and abilities

Read from wp-self-test at v2.2.5.

## REST routes

### GET /wp-json/mmwp/v1/self-test/cases

Permission: Callback check_permission().

| Argument | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| ids | array |  | [] | Case ids from the registered manifests. Empty for every case. |
| plugin | string |  | '' | Restrict to the cases of one registered plugin slug. |

Source: https://github.com/mammothwp/wp-self-test/blob/v2.2.5/src/Surfaces/Rest.php#L87

### GET /wp-json/mmwp/v1/self-test/preview

Permission: Callback check_permission().

| Argument | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| ids | array |  | [] | Case ids from the registered manifests. Empty for every case. |
| plugin | string |  | '' | Restrict to the cases of one registered plugin slug. |

Source: https://github.com/mammothwp/wp-self-test/blob/v2.2.5/src/Surfaces/Rest.php#L94

### POST /wp-json/mmwp/v1/self-test/run

Permission: Callback check_permission().

| Argument | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| ids | array |  | [] | Case ids from the registered manifests. Empty for every case. |
| plugin | string |  | '' | Restrict to the cases of one registered plugin slug. |
| cleanup | boolean |  | false | Remove the test data right after each case instead of keeping it for "Remove test data". |
| layer | string |  | '' | Run only the cases declaring this layer (rest, cli, ability, core, browser). |

Source: https://github.com/mammothwp/wp-self-test/blob/v2.2.5/src/Surfaces/Rest.php#L101

### POST /wp-json/mmwp/v1/self-test/cleanup

Permission: Callback check_permission().

| Argument | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| ids | array |  | [] | Case ids from the registered manifests. Empty for every case. |
| plugin | string |  | '' | Restrict to the cases of one registered plugin slug. |

Source: https://github.com/mammothwp/wp-self-test/blob/v2.2.5/src/Surfaces/Rest.php#L125

### GET /wp-json/mmwp/v1/self-test/report

Permission: Callback check_permission().

Source: https://github.com/mammothwp/wp-self-test/blob/v2.2.5/src/Surfaces/Rest.php#L132

### GET /wp-json/mmwp/v1/self-test/admin-menu

Permission: Callback check_permission().

Source: https://github.com/mammothwp/wp-self-test/blob/v2.2.5/src/Surfaces/Rest.php#L138

### POST /wp-json/mmwp/v1/self-test/browser-login

Permission: Permission of the login exchange: the token is the credential. Callback check_login_token().

| Argument | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| token | string | yes |  | Single-use login token issued by the runner for the browser layer. |

Source: https://github.com/mammothwp/wp-self-test/blob/v2.2.5/src/Surfaces/Rest.php#L144

## Abilities

### mmwp/self-test-list-cases

List self-test cases: The cases every registered plugin declares, with their plugin, category, the surfaces (rest/cli/ability) they cover, whether they can run on this site and whether an earlier run left test data behind.

Source: https://github.com/mammothwp/wp-self-test/blob/v2.2.5/src/Surfaces/Abilities.php#L98

### mmwp/self-test-preview

Preview self-test steps: The ordered steps each case would perform, without running anything.

Source: https://github.com/mammothwp/wp-self-test/blob/v2.2.5/src/Surfaces/Abilities.php#L106

### mmwp/self-test-run

Run self-tests: Run the given cases (default: all), validate every surface and store the report. Creates test data on this site unless cleanup is true; pass confirm: true.

Source: https://github.com/mammothwp/wp-self-test/blob/v2.2.5/src/Surfaces/Abilities.php#L114

### mmwp/self-test-cleanup

Remove self-test data: Delete the test data left by earlier runs (default: every case with pending data). Pass confirm: true.

Source: https://github.com/mammothwp/wp-self-test/blob/v2.2.5/src/Surfaces/Abilities.php#L122

### mmwp/self-test-get-report

Get the last self-test report: The report stored by the most recent run: summary counts and per-case checks.

Source: https://github.com/mammothwp/wp-self-test/blob/v2.2.5/src/Surfaces/Abilities.php#L131
