-
Notifications
You must be signed in to change notification settings - Fork 438
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Resolve env placeholders in configuration
- Loading branch information
Showing
4 changed files
with
82 additions
and
19 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace GrumPHPTest\E2E; | ||
|
||
class ConfigurationTest extends AbstractE2ETestCase | ||
{ | ||
/** @test */ | ||
function it_should_be_able_to_resolve_env_variable_in_configuration() | ||
{ | ||
$this->initializeGitInRootDir(); | ||
$this->initializeComposer($this->rootDir); | ||
$grumphpFile = $this->initializeGrumphpConfig(path: $this->rootDir, customConfig: [ | ||
'parameters' => [ | ||
'env(GRUMPHP_PARAMETER_TEST)' => '~' | ||
], | ||
'grumphp' => [ | ||
'ascii' => [ | ||
'succeeded' => '%env(string:GRUMPHP_PARAMETER_TEST)%', | ||
], | ||
], | ||
]); | ||
|
||
$this->installComposer($this->rootDir); | ||
$this->ensureHooksExist(); | ||
|
||
$this->enableValidatePathsTask($grumphpFile, $this->rootDir); | ||
|
||
$this->commitAll(); | ||
$process = $this->runGrumphp(projectPath: $this->rootDir, environment: [ | ||
'GRUMPHP_PARAMETER_TEST' => 'succeeded.txt', | ||
]); | ||
|
||
$this->assertStringContainsString( | ||
file_get_contents(PROJECT_BASE_PATH . '/resources/ascii/succeeded.txt'), | ||
$process->getOutput(), | ||
); | ||
} | ||
} |