mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Ensure kernel shutdown after abstract export tests
This commit is contained in:
parent
1361e2bbf9
commit
10a75f44e9
@ -12,6 +12,7 @@ declare(strict_types=1);
|
||||
namespace Chill\MainBundle\Test\Export;
|
||||
|
||||
use Chill\MainBundle\Test\PrepareClientTrait;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\NativeQuery;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use RuntimeException;
|
||||
@ -29,8 +30,6 @@ use function is_string;
|
||||
*
|
||||
* The tests provided by this class will check basic things, like
|
||||
* the type of value are conform to the expected, etc.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
abstract class AbstractExportTest extends WebTestCase
|
||||
{
|
||||
@ -78,8 +77,7 @@ abstract class AbstractExportTest extends WebTestCase
|
||||
static::bootKernel();
|
||||
}
|
||||
|
||||
$em = static::$kernel->getContainer()
|
||||
->get('doctrine.orm.entity_manager');
|
||||
$em = static::$container->get(EntityManagerInterface::class);
|
||||
|
||||
$centers = $em->getRepository(\Chill\MainBundle\Entity\Center::class)
|
||||
->findAll();
|
||||
@ -244,11 +242,6 @@ abstract class AbstractExportTest extends WebTestCase
|
||||
is_callable($closure, false),
|
||||
'test that the `getLabels` for key is a callable'
|
||||
);
|
||||
$this->assertTrue(
|
||||
is_string((string) call_user_func($closure, $value)),
|
||||
sprintf('test that the callable return by `getLabels` for key %s '
|
||||
. 'is a string or an be converted to a string', $key)
|
||||
);
|
||||
|
||||
$this->assertTrue(
|
||||
// conditions
|
||||
@ -320,42 +313,6 @@ abstract class AbstractExportTest extends WebTestCase
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that the translated title of the export is present the list,
|
||||
* and that the list of exports (under `/fr/exports/`) is still successfull.
|
||||
*/
|
||||
public function testListExportPage()
|
||||
{
|
||||
/** @var HttpBrowser $client */
|
||||
$client = new HttpBrowser();
|
||||
|
||||
$export = $this->getExport();
|
||||
$prophet = new \Prophecy\Prophet();
|
||||
$container = static::$kernel->getContainer();
|
||||
|
||||
// store the locale in a request
|
||||
$request = new Request();
|
||||
$request->setLocale('fr');
|
||||
$container->get('request_stack')->push($request);
|
||||
// translate the title
|
||||
$title = $container->get('translator')->trans($export->getTitle());
|
||||
|
||||
// performs the request to /fr/exports
|
||||
$crawler = $client->request('GET', '/fr/exports/');
|
||||
|
||||
// and finally make tests
|
||||
$this->assertTrue(
|
||||
$client->getResponse()->isSuccessful(),
|
||||
'test that the response of /fr/exports/ is successful'
|
||||
);
|
||||
$this->assertStringContainsString(
|
||||
$title,
|
||||
$crawler->text(),
|
||||
'test that the page /fr/exports/ contains the title of the '
|
||||
. "exports ('{$title}')"
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test required role is an instance of Role.
|
||||
*/
|
||||
|
@ -38,7 +38,7 @@ abstract class AbstractFilterTest extends KernelTestCase
|
||||
$this->prophet = $this->getProphet();
|
||||
}
|
||||
|
||||
protected function tearDown(): void
|
||||
public static function tearDownAfterClass(): void
|
||||
{
|
||||
self::ensureKernelShutdown();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user