Skip to content
Snippets Groups Projects
Commit 78dc8477 authored by Laurent's avatar Laurent
Browse files

Fix cosmopath when a directory named '0' exists

parent c696b995
Branches
Tags
No related merge requests found
......@@ -30,7 +30,7 @@ class CosmoPaths {
public function getBasePath() {
$parts = array_filter(explode('/', $this->getFilePath()));
$parts = explode('/', $this->getFilePath());
while ((count($parts)>0) && (end($parts) !== static::$_dir_name))
array_pop($parts);
array_pop($parts);
......
......@@ -217,4 +217,26 @@ class CosmoPathsFromCommandLineTest extends CosmoPathsTestCase {
}
class CosmoPathsFromGitlabCiRunnerTest extends PHPUnit_Framework_TestCase {
protected $_cosmo_paths;
public function setUp() {
parent::setUp();
unset($_SERVER);
$this->_cosmo_paths = new CosmoPaths();
$this->_cosmo_paths->setFileSystem(Storm_Test_ObjectWrapper::mock()
->whenCalled('getcwd')
->answers('/home/gitlab-multi-runner/builds/5287e4bf/0/afi/negative/bokeh/cosmogramme'));
}
/** @test */
public function bokehConfigPathShouldContainsDirectoryZero() {
$this->assertContains('builds/5287e4bf/0/afi/negative/bokeh/config.ini',
$this->_cosmo_paths->getBokehConfigPath());
}
}
?>
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment