* symfony 6.3: removed sensio/framework-extra-bundle * symfony 6.3: update * Symfony 6.3.1 update * chore: composer up * symfony 6.4 update * cs: php-code-fixer update * fix composer.lock * add php-http required dependencies * Fix Stan and CS --------- Co-authored-by: Jérôme Tanghe <jerome.tanghe@les-tilleuls.coop>
49 lines
1.8 KiB
PHP
49 lines
1.8 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Tests\Functional\Controller\Admin;
|
|
|
|
use App\Controller\Admin\CategoryServiceCrudController;
|
|
use App\Test\KernelTrait;
|
|
use App\Tests\TestReference;
|
|
use Hautelook\AliceBundle\PhpUnit\RefreshDatabaseTrait;
|
|
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
|
|
|
final class CategoryServiceCrudControllerTest extends WebTestCase
|
|
{
|
|
use KernelTrait;
|
|
use RefreshDatabaseTrait;
|
|
|
|
public function testController(): void
|
|
{
|
|
$client = self::createClient();
|
|
$this->loginAsAdmin($client);
|
|
|
|
// list
|
|
$client->request('GET', \sprintf(TestReference::ADMIN_URL, 'index', CategoryServiceCrudController::class));
|
|
self::assertResponseIsSuccessful();
|
|
|
|
// edit
|
|
$client->request('GET', \sprintf(TestReference::ADMIN_URL.'&entityId=%s', 'edit', CategoryServiceCrudController::class, TestReference::CATEGORY_SERVICE_1));
|
|
self::assertResponseIsSuccessful();
|
|
|
|
// detail
|
|
$client->request('GET', \sprintf(TestReference::ADMIN_URL.'&entityId=%s', 'detail', CategoryServiceCrudController::class, TestReference::CATEGORY_SERVICE_1));
|
|
self::assertResponseIsSuccessful();
|
|
|
|
// new
|
|
$crawler = $client->request('GET', \sprintf(TestReference::ADMIN_URL, 'new', CategoryServiceCrudController::class));
|
|
self::assertResponseIsSuccessful();
|
|
|
|
$form = $crawler->selectButton(TestReference::ACTION_SAVE_AND_RETURN)->form();
|
|
$client->submit($form, [
|
|
$form->getName().'[name]' => 'category service foo',
|
|
$form->getName().'[parent]' => TestReference::CATEGORY_SERVICE_1,
|
|
$form->getName().'[enabled]' => 1,
|
|
]);
|
|
self::assertResponseRedirects();
|
|
$client->followRedirect();
|
|
self::assertResponseIsSuccessful();
|
|
}
|
|
}
|