generated from parler-haut-interagir-librement/MicroSymfony
/
SlugifyActionTest.php
34 lines (29 loc) · 1010 Bytes
/
SlugifyActionTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
declare(strict_types=1);
namespace App\Tests\Api\Controller;
use App\Controller\SlugifyAction;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
/**
* @internal
*/
final class SlugifyActionTest extends WebTestCase
{
/**
* You have advanced JSON assertions in API Platform.
*
* @see https://api-platform.com/docs/distribution/testing/#writing-functional-tests
* @see SlugifyAction
*/
public function testSlugifyAction(): void
{
$client = self::createClient();
$client->request('GET', '/api/slugify?title=This IS the _-! Micro SYMFONY project');
self::assertResponseIsSuccessful();
self::isJson();
self::assertJsonStringEqualsJsonString('{"slug":"this-is-the-micro-symfony-project"}', (string) $client->getResponse()->getContent());
// With the ApiTestCase, these tests would look like
// $this->assertJsonContains([
// 'slug' => 'this-is-the-micro-symfony-project',
// ]);
}
}