From baccad34b63308d2b5a866b30b122d32f5fba2c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Noco=C5=84?= Date: Wed, 18 Apr 2018 17:15:38 +0200 Subject: [PATCH] EZP-28224: Change the way cache is cleared in Behat tests (#2308) --- .../Features/Context/YamlConfigurationContext.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/eZ/Bundle/EzPublishCoreBundle/Features/Context/YamlConfigurationContext.php b/eZ/Bundle/EzPublishCoreBundle/Features/Context/YamlConfigurationContext.php index 2e0ff6c68e8..b4ad233ecbb 100644 --- a/eZ/Bundle/EzPublishCoreBundle/Features/Context/YamlConfigurationContext.php +++ b/eZ/Bundle/EzPublishCoreBundle/Features/Context/YamlConfigurationContext.php @@ -6,6 +6,9 @@ namespace eZ\Bundle\EzPublishCoreBundle\Features\Context; use Behat\Behat\Context\Context; +use Behat\Symfony2Extension\Context\KernelDictionary; +use Symfony\Bundle\FrameworkBundle\Console\Application; +use Symfony\Component\Console\Input\ArrayInput; use Symfony\Component\Yaml\Yaml; /** @@ -16,6 +19,8 @@ */ class YamlConfigurationContext implements Context { + use KernelDictionary; + private static $platformConfigurationFilePath = 'app/config/ezplatform_behat.yml'; public function addConfiguration(array $configuration) @@ -30,7 +35,14 @@ public function addConfiguration(array $configuration) $this->addImportToPlatformYaml($destinationFileName); - shell_exec('php bin/console --env=behat cache:clear'); + $application = new Application($this->getKernel()); + $application->setAutoExit(false); + + $input = new ArrayInput([ + 'command' => 'cache:clear', + ]); + + $application->run($input); } private function addImportToPlatformYaml($importedFileName)