Skip to content

Commit

Permalink
Failing unit test on codeship not sure why yet --skip-ui
Browse files Browse the repository at this point in the history
  • Loading branch information
alnutile committed Dec 4, 2015
1 parent d7faa41 commit 4546861
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 5 deletions.
11 changes: 9 additions & 2 deletions src/BaseDeployer.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,26 @@ class BaseDeployer {

public function checkForFile($path = false)
{
$path = ($path) ? $path : $this->filePath;
$path = ($path) ? $path : $this->getFilePath();

if(!$this->getFilesystem()->exists($path))
throw new \Exception(sprintf("No file found at -> %s",
$path));
}

public function setFilePath($filePath)
public function setFilePath($filePath = false)
{
if($filePath == false)
$filePath = base_path();

$this->filePath = $filePath;
}

public function getFilePath()
{
if($this->filePath == null)
$this->setFilePath();

return $this->filePath;
}

Expand Down Expand Up @@ -73,6 +79,7 @@ protected function makeEnvArrayFromFile($path_with_name = false)
{

$path_with_name = ($path_with_name) ? $path_with_name : $this->filePath;

/**
* Thanks to Dotenv library by vlucas
*/
Expand Down
20 changes: 19 additions & 1 deletion tests/BuildArrayFromEnvTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ class BuildArrayFromEnvTest extends \TestCase
*/
public function should_load_file()
{
$this->markTestSkipped("Just not needed on codship");
$this->markTestSkipped("Just not needed on codeship");


$ba = (new BuildArrayFromEnv())->setTarget('dev');
$results = $ba->getEnv();
Expand Down Expand Up @@ -47,6 +48,23 @@ public function should_include_default_settings_as_well_not_just_replaced_ones()
$this->assertCount(2, $ba->getTargetEnv());
}

/**
* @test
*/
public function make_sure_false_has_no_quotes()
{
$ba = (new BuildArrayFromEnv())->setTarget('dev');
$ba->setEnv(
[
"#@dev=false",
"#@stage=false",
"APP_ENV=true",
]);
$ba->buildOutNewEnvArray();

$this->assertEquals('APP_ENV=false', $ba->getTargetEnv()[0]);
}

/**
* @test
*/
Expand Down
4 changes: 2 additions & 2 deletions tests/PullEnvTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

if(!function_exists('base_path'))
{
function base_path()
function base_path($arg = '')
{
return '';
return __DIR__ . '/../' . $arg;
}
}
class PullEnvTest extends \TestCase {
Expand Down

0 comments on commit 4546861

Please sign in to comment.