PHP code example of speicher210 / functional-test-bundle
1. Go to this page and download the library: Download speicher210/functional-test-bundle 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/ */
speicher210 / functional-test-bundle example snippets
declare(strict_types=1);
'/vendor/speicher210/functional-test-bundle/src/Test/bootstrap.php';
// $kernel variable will contain the current Kernel instance
declare(strict_types=1);
use Speicher210\FunctionalTestBundle\Test\RestControllerWebTestCase;
use Symfony\Component\HttpFoundation\Request;
final class MyUserEndpointTest extends RestControllerWebTestCase
{
public function testReturn404IfUserIsNotFound() : void
{
$this->assertRestRequestReturns404('/api/user/1', Request::METHOD_GET);
}
public function testReturns200AndUserData() : void
{
$this->assertRestGetPath('/api/user/1');
}
}