Skip to content

Commit

Permalink
Merge pull request #1316 from fbourigault/re-enable-functional-tests
Browse files Browse the repository at this point in the history
Fix skipped functional tests with Symfony 5.x
  • Loading branch information
dbu authored Dec 16, 2020
2 parents da5ec9b + cb7daec commit 4704b34
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 18 deletions.
2 changes: 1 addition & 1 deletion Tests/Functional/AbstractSetupWebTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function setUp(): void

$this->client = $this->createClient();
$this->client->catchExceptions(false);
$this->webRoot = sprintf('%s/public', self::$kernel->getContainer()->getParameter('kernel.root_dir'));
$this->webRoot = sprintf('%s/public', self::$kernel->getContainer()->getParameter('kernel.project_dir'));
$this->cacheRoot = $this->webRoot.'/media/cache';
$this->filesystem = new Filesystem();
$this->filesystem->remove($this->cacheRoot);
Expand Down
20 changes: 8 additions & 12 deletions Tests/Functional/AbstractWebTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,6 @@

abstract class AbstractWebTestCase extends WebTestCase
{
/**
* {@inheritdoc}
*/
public static function createClient(array $options = [], array $server = [])
{
if (!class_exists(Client::class)) {
self::markTestSkipped('Requires the symfony/browser-kit package.');
}

return parent::createClient($options, $server);
}

/**
* @return string
*/
Expand All @@ -44,6 +32,10 @@ public static function getKernelClass()
*/
protected function getService(string $name)
{
if (property_exists($this, 'container')) {
return static::$container->get($name);
}

return static::$kernel->getContainer()->get($name);
}

Expand All @@ -52,6 +44,10 @@ protected function getService(string $name)
*/
protected function getParameter(string $name)
{
if (property_exists($this, 'container')) {
return static::$container->getParameter($name);
}

return static::$kernel->getContainer()->getParameter($name);
}

Expand Down
5 changes: 5 additions & 0 deletions Tests/Functional/app/AppKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ public function getLogDir()
return sys_get_temp_dir().'/liip_imagine_test/cache/logs';
}

public function getProjectDir()
{
return __DIR__;
}

/**
* @throws \Exception
*/
Expand Down
10 changes: 5 additions & 5 deletions Tests/Functional/app/config/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ framework:
storage_id: session.storage.mock_file

router:
resource: "%kernel.root_dir%/config/routing.yml"
resource: "%kernel.project_dir%/config/routing.yml"

liip_imagine:

Expand All @@ -29,15 +29,15 @@ liip_imagine:

default:
filesystem:
data_root: "%kernel.root_dir%/public"
data_root: "%kernel.project_dir%/public"

foo:
filesystem:
data_root: "%kernel.root_dir%/../../Fixtures/FileSystemLocator/root-01"
data_root: "%kernel.project_dir%/../../Fixtures/FileSystemLocator/root-01"

bar:
filesystem:
data_root: "%kernel.root_dir%/../../Fixtures/FileSystemLocator/root-02"
data_root: "%kernel.project_dir%/../../Fixtures/FileSystemLocator/root-02"

baz:
chain:
Expand Down Expand Up @@ -73,7 +73,7 @@ liip_imagine:

default:
web_path:
web_root: "%kernel.root_dir%/public"
web_root: "%kernel.project_dir%/public"
cache_prefix: media/cache

filter_sets:
Expand Down

0 comments on commit 4704b34

Please sign in to comment.