PHP code example of lombokclarion / testing
1. Go to this page and download the library: Download lombokclarion/testing library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
lombokclarion / testing example snippets
LombokClarion\Testing
use LombokClarion\Testing\HttpTestCase;
class WidgetTest extends HttpTestCase {
public function testCreateWidget(): void {
$this->override(WidgetRepository::class, new InMemoryRepository());
$response = $this->post('/api/widgets', ['name' => 'Test']);
$this->assertStatus($response, 201);
}
}
// Fake bus (unit test)
$bus = new FakeCommandBus();
$bus->dispatch(new CreateWidget('Gadget'));
$bus->assertDispatched(CreateWidget::class);
// Cold-start test (in CI)
$test = new ColdStartTest(budgetMs: 5.0);
$test->run(); // fails if boot exceeds 5ms