-
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #48: Allows all configuration to be overwritten with environmen…
…t variables and refactors the setup commands.
- Loading branch information
Showing
6 changed files
with
221 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
<?php | ||
|
||
namespace AcquiaCli\Tests\Commands; | ||
|
||
use Robo\Robo; | ||
use AcquiaCli\Cli\Config; | ||
use AcquiaCli\Cli\AcquiaCli; | ||
use AcquiaCli\Tests\AcquiaCliTestCase; | ||
use Symfony\Component\Console\Input\ArgvInput; | ||
use Consolidation\Config\Loader\ConfigProcessor; | ||
use Consolidation\Config\Loader\YamlConfigLoader; | ||
use Symfony\Component\Console\Output\BufferedOutput; | ||
|
||
class SetupCommandTest extends AcquiaCliTestCase | ||
{ | ||
|
||
public function testSetupConfigViewDefault() | ||
{ | ||
$command = ['setup:config:view']; | ||
$defaultConfiguration = <<< DEFAULT | ||
Default configuration | ||
acquia: | ||
key: 'd0697bfc-7f56-4942-9205-b5686bf5b3f5' | ||
secret: 'D5UfO/4FfNBWn4+0cUwpLOoFzfP7Qqib4AoY+wYGsKE=' | ||
extraconfig: | ||
timezone: 'Australia/Sydney' | ||
format: 'Y-m-d H:i:s' | ||
taskwait: 5 | ||
timeout: 300 | ||
Running configuration | ||
acquia: | ||
key: d0697bfc-7f56-4942-9205-b5686bf5b3f5 | ||
secret: D5UfO/4FfNBWn4+0cUwpLOoFzfP7Qqib4AoY+wYGsKE= | ||
extraconfig: | ||
timezone: Australia/Sydney | ||
format: 'Y-m-d H:i:s' | ||
taskwait: 5 | ||
timeout: 300 | ||
DEFAULT; | ||
|
||
$actualResponse = $this->execute($command); | ||
$this->assertSame($defaultConfiguration, $actualResponse); | ||
} | ||
|
||
public function testSetupConfigViewOverwritten() | ||
{ | ||
$command = ['setup:config:view']; | ||
$overwrittenConfiguration = <<< OVERWRITTEN | ||
Default configuration | ||
acquia: | ||
key: 'd0697bfc-7f56-4942-9205-b5686bf5b3f5' | ||
secret: 'D5UfO/4FfNBWn4+0cUwpLOoFzfP7Qqib4AoY+wYGsKE=' | ||
extraconfig: | ||
timezone: 'Australia/Sydney' | ||
format: 'Y-m-d H:i:s' | ||
taskwait: 5 | ||
timeout: 300 | ||
Environment configuration | ||
extraconfig: | ||
timezone: Australia/Melbourne | ||
format: U | ||
Running configuration | ||
acquia: | ||
key: d0697bfc-7f56-4942-9205-b5686bf5b3f5 | ||
secret: D5UfO/4FfNBWn4+0cUwpLOoFzfP7Qqib4AoY+wYGsKE= | ||
extraconfig: | ||
timezone: Australia/Melbourne | ||
format: U | ||
taskwait: 5 | ||
timeout: 300 | ||
OVERWRITTEN; | ||
|
||
putenv('ACQUIACLI_TIMEZONE=Australia/Melbourne'); | ||
putenv('ACQUIACLI_FORMAT=U'); | ||
|
||
$actualResponse = $this->execute($command); | ||
$this->assertSame($overwrittenConfiguration, $actualResponse); | ||
|
||
putenv('ACQUIACLI_TIMEZONE='); | ||
putenv('ACQUIACLI_FORMAT='); | ||
} | ||
} |