PHP code example of richcongress / unit-bundle
1. Go to this page and download the library: Download richcongress/unit-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/ */
richcongress / unit-bundle example snippets
class MainControllerTest extends ControllerTestCase
{
/**
* @WithFixtures
*
* @return void
*/
public function testIndex(): void
{
$client = self::createClient();
$client->request('GET', '/');
self::assertStatusCode(Response::HTTP_OK, $client);
}
/**
* @WithFixtures
*
* @return void
*/
public function testUserEdition(): void
{
$client = $this->createClientWith('user-1');
$client->request('PUT', '/rest/users/self', ['name' => 'Karl']);
self::assertStatusCode(Response::HTTP_OK, $client);
$content = self::getJsonContent($client);
self::assertArrayKeyExists('name', $content);
self::assertSame('Karl', $content['name']);
}
}
new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle::class => ['test' => true],
new Liip\FunctionalTestBundle\LiipFunctionalTestBundle::class => ['test' => true],
new Liip\TestFixturesBundle\LiipTestFixturesBundle::class => ['test' => true],
new RichCongress\Bundle\UnitBundle\RichCongressUnitBundle::class => ['test' => true],