Fix some tests

This commit is contained in:
2023-12-14 21:18:00 +01:00
parent d5476df14c
commit 2dd1b7c943
11 changed files with 92 additions and 127 deletions

View File

@@ -11,6 +11,7 @@ declare(strict_types=1);
namespace Chill\MainBundle\Tests\Controller;
use Chill\MainBundle\Test\PrepareClientTrait;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
/**
@@ -22,9 +23,11 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
*/
final class SearchControllerTest extends WebTestCase
{
use PrepareClientTrait;
public function testDomainUnknow()
{
$client = $this->getAuthenticatedClient();
$client = $this->getClientAuthenticated();
$crawler = $client->request('GET', '/fr/search', ['q' => '@unknow domain']);
@@ -41,7 +44,7 @@ final class SearchControllerTest extends WebTestCase
public function testParsingIncorrect()
{
$client = $this->getAuthenticatedClient();
$client = $this->getClientAuthenticated();
$crawler = $client->request(
'GET',
@@ -59,7 +62,7 @@ final class SearchControllerTest extends WebTestCase
*/
public function testSearchPath()
{
$client = $this->getAuthenticatedClient();
$client = $this->getClientAuthenticated();
$crawler = $client->request('GET', '/fr/search', ['q' => 'default search']);
@@ -71,7 +74,7 @@ final class SearchControllerTest extends WebTestCase
public function testSearchPathEmpty()
{
$client = $this->getAuthenticatedClient();
$client = $this->getClientAuthenticated();
$crawler = $client->request('GET', '/fr/search?q=');
@@ -80,7 +83,7 @@ final class SearchControllerTest extends WebTestCase
public function testUnknowName()
{
$client = $this->getAuthenticatedClient();
$client = $this->getClientAuthenticated();
$client->request(
'GET',
@@ -90,12 +93,4 @@ final class SearchControllerTest extends WebTestCase
$this->assertTrue($client->getResponse()->isNotFound());
}
private function getAuthenticatedClient()
{
return self::createClient([], [
'PHP_AUTH_USER' => 'center b_social',
'PHP_AUTH_PW' => 'password',
]);
}
}