1. Go to this page and download the library: Download dotdev/api-test-case 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/ */
dotdev / api-test-case example snippets
namespace AppBundle\Tests\Controller\HelloWorldTest;
use ApiTestCase\JsonApiTestCase;
class HelloWorldTest extends JsonApiTestCase
{
public function testGetHelloWorldResponse()
{
$this->client->request('GET', '/');
$response = $this->client->getResponse();
$this->assertResponse($response, 'hello_world');
}
}
// app/AppKernel.php
class AppKernel extends Kernel
{
public function registerBundles()
{
// ...
if ('test' === $this->getEnvironment()) {
new Nelmio\Alice\Bridge\Symfony\NelmioAliceBundle(),
new Fidry\AliceDataFixtures\Bridge\Symfony\FidryAliceDataFixturesBundle(),
}
}
}
class Book
{
private $id;
private $title;
private $author;
// ...
}
public function testBooksIndexAction()
{
// This method here is another method that allows you to load fixtures from directory.
$this->loadFixturesFromDirectory('big_library');
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.