* 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>
55 lines
1.9 KiB
PHP
55 lines
1.9 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Tests\Functional\Controller\Admin;
|
|
|
|
use App\Controller\Admin\ServiceCrudController;
|
|
use App\Test\KernelTrait;
|
|
use App\Tests\TestReference;
|
|
use Hautelook\AliceBundle\PhpUnit\RefreshDatabaseTrait;
|
|
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
|
|
|
final class ServiceCrudControllerTest extends WebTestCase
|
|
{
|
|
use KernelTrait;
|
|
use RefreshDatabaseTrait;
|
|
|
|
/**
|
|
* @see ServiceCrudController
|
|
*/
|
|
public function testController(): void
|
|
{
|
|
$client = self::createClient();
|
|
$this->loginAsAdmin($client);
|
|
|
|
// list
|
|
$client->request('GET', \sprintf(TestReference::ADMIN_URL, 'index', ServiceCrudController::class));
|
|
self::assertResponseIsSuccessful();
|
|
|
|
// edit
|
|
$client->request('GET', \sprintf(TestReference::ADMIN_URL.'&entityId=%s', 'edit', ServiceCrudController::class, TestReference::SERVICE_LOIC_1));
|
|
self::assertResponseIsSuccessful();
|
|
|
|
// detail
|
|
$client->request('GET', \sprintf(TestReference::ADMIN_URL.'&entityId=%s', 'detail', ServiceCrudController::class, TestReference::SERVICE_LOIC_1));
|
|
self::assertResponseIsSuccessful();
|
|
|
|
// new
|
|
$crawler = $client->request('GET', \sprintf(TestReference::ADMIN_URL, 'new', ServiceCrudController::class));
|
|
self::assertResponseIsSuccessful();
|
|
|
|
$form = $crawler->selectButton(TestReference::ACTION_SAVE_AND_RETURN)->form();
|
|
$client->submit($form, [
|
|
$form->getName().'[name]' => 'Object public',
|
|
$form->getName().'[visibility]' => 'public',
|
|
$form->getName().'[status]' => 'active',
|
|
$form->getName().'[owner]' => TestReference::ADMIN_LOIC,
|
|
$form->getName().'[description]' => 'very nice object',
|
|
$form->getName().'[duration]' => '1 hour',
|
|
]);
|
|
self::assertResponseRedirects();
|
|
$client->followRedirect();
|
|
self::assertResponseIsSuccessful();
|
|
}
|
|
}
|