kbin-core/tests/Functional/Controller/Post/Comment/PostCommentChangeLangControllerTest.php
Ernest Wiśniewski a5f15a0b55 Symfony upgrade
2023-04-15 15:06:09 +02:00

32 lines
987 B
PHP

<?php
declare(strict_types=1);
namespace App\Tests\Functional\Controller\Post\Comment;
use App\Tests\WebTestCase;
class PostCommentChangeLangControllerTest extends WebTestCase
{
public function testModCanChangeLanguage(): void
{
$client = $this->createClient();
$client->loginUser($this->getUserByUsername('JohnDoe'));
$comment = $this->createPostComment('test comment 1');
$crawler = $client->request('GET', "/m/acme/p/{$comment->post->getId()}/-/reply/{$comment->getId()}/moderate");
$this->assertSelectorTextContains('select[name="lang[lang]"] option[selected]', 'english');
$form = $crawler->filter('.moderate-panel')->selectButton('change language')->form();
$values = $form['lang']['lang']->availableOptionValues();
$form['lang']['lang']->select($values[5]);
$client->submit($form);
$client->followRedirect();
$this->assertSelectorTextContains('#main .badge', 'fr');
}
}