Smoke test means: do a very quick check to see whether the app is basically working at all.
Summary: Check quickly that the app is alive.
Here are the endpoints we want to test quickly:
$home = $client->request('GET', $server['url'] . '/');
$api = $client->request('GET', $server['url'] . '/api/lessons');
$detail = $client->request('GET', $server['url'] . '/api/lessons/php-basics');Now we can create a test like this:
$this->assertSame(200, $home['status']);
$this->assertSame(200, $api['status']);
$this->assertSame(200, $detail['status']);
Why this test works
- This test is about important URLs, not about one class.
- That is why the file lives in tests/http.
- Put this file in tests/http/SmokeTest.php because it hits real endpoints.
- Keep smoke tests very short.
- Only check the most important paths.
- Simple rule: if these fail, the app probably has a big problem.
Real-life examples
- Example: on a company website, check that /, /login, and /contact all return status 200.
- Example: on a shop website, check that /, /products, and /cart all respond without crashing.
Remember this
- Put file in tests/http
- Keep it short
- Run with php tests/run.php smoke