PHP code example of codetetic / pest-plugin-symfony
1. Go to this page and download the library: Download codetetic/pest-plugin-symfony 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/ */
use function Pest\Symfony\Web\createClient;
use function Pest\Symfony\Web\getRequest;
use function Pest\Symfony\Web\getResponse;
it('can get a 200 response from /example', function (): void {
createClient()->request('GET', '/example');
expect(getResponse())->toHaveIsSuccessful();
expect(getRequest()->getMethod())->toBe('GET');
expect(getResponse()->getContent())->toMatchSnapshot();
});
use function Pest\Symfony\Kernel\getContainer;
it('can get and use service', function (): void {
expect(
getContainer()
->get(App\Service\ExampleService::class)
->string('string')
)->toBe('string');
});
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.