Skip to content

Commit

Permalink
Adding support for changing root dir and project dir (SymfonyTest#5)
Browse files Browse the repository at this point in the history
* Adding support for changing root dir and project dir

* Removed PHP7 syntax
  • Loading branch information
Nyholm committed Jul 14, 2017
1 parent 3a07467 commit 59d45ea
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/AppKernel.php
Expand Up @@ -28,6 +28,11 @@ class AppKernel extends Kernel
*/
private $cachePrefix = '';

/**
* @var string|null;
*/
private $fakedProjectDir;

/**
* @param string $cachePrefix
*/
Expand Down Expand Up @@ -65,6 +70,31 @@ public function getLogDir()
return sys_get_temp_dir().'/NyholmBundleTest/log';
}

public function getProjectDir()
{
if (null === $this->fakedProjectDir) {
return realpath(__DIR__.'/../../../../');
}

return $this->fakedProjectDir;
}

/**
* @param string|null $rootDir
*/
public function setRootDir($rootDir)
{
$this->rootDir = $rootDir;
}

/**
* @param string|null $projectDir
*/
public function setProjectDir($projectDir)
{
$this->fakedProjectDir = $projectDir;
}

public function registerBundles()
{
$this->bundlesToRegister = array_unique($this->bundlesToRegister);
Expand Down

0 comments on commit 59d45ea

Please sign in to comment.