Skip to content

Commit 59d45ea

Browse files
authored
Adding support for changing root dir and project dir (#5)
* Adding support for changing root dir and project dir * Removed PHP7 syntax
1 parent 3a07467 commit 59d45ea

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

src/AppKernel.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ class AppKernel extends Kernel
2828
*/
2929
private $cachePrefix = '';
3030

31+
/**
32+
* @var string|null;
33+
*/
34+
private $fakedProjectDir;
35+
3136
/**
3237
* @param string $cachePrefix
3338
*/
@@ -65,6 +70,31 @@ public function getLogDir()
6570
return sys_get_temp_dir().'/NyholmBundleTest/log';
6671
}
6772

73+
public function getProjectDir()
74+
{
75+
if (null === $this->fakedProjectDir) {
76+
return realpath(__DIR__.'/../../../../');
77+
}
78+
79+
return $this->fakedProjectDir;
80+
}
81+
82+
/**
83+
* @param string|null $rootDir
84+
*/
85+
public function setRootDir($rootDir)
86+
{
87+
$this->rootDir = $rootDir;
88+
}
89+
90+
/**
91+
* @param string|null $projectDir
92+
*/
93+
public function setProjectDir($projectDir)
94+
{
95+
$this->fakedProjectDir = $projectDir;
96+
}
97+
6898
public function registerBundles()
6999
{
70100
$this->bundlesToRegister = array_unique($this->bundlesToRegister);

0 commit comments

Comments
 (0)