public function testSwitchProfileComplex()
{
putenv('ACCOUNT=t');
putenv('BASE_TYPE_VERSION=42');
$profileManagerMock = $this->getMock('\\StackFormation\\Profile\\Manager', [], [], '', false);
$profileManagerMock->method('getStackFactory')->willReturnCallback(function () {
$stackFactoryMock = $this->getMock('\\StackFormation\\StackFactory', ['getStackOutput'], [], '', false);
$stackFactoryMock->method('getStackOutput')->willReturnCallback(function ($stackName, $key) {
return "DummyValue|{$stackName}|{$key}";
});
return $stackFactoryMock;
});
$config = new \StackFormation\Config([FIXTURE_ROOT . 'Config/blueprint.switch_profile.yml']);
$valueResolver = new \StackFormation\ValueResolver\ValueResolver(null, $profileManagerMock, $config);
$blueprintFactory = new \StackFormation\BlueprintFactory($config, $valueResolver);
$blueprint = $blueprintFactory->getBlueprint('switch_profile_complex');
$parameters = $blueprint->getParameters(true);
$parameters = Div::flatten($parameters, 'ParameterKey', 'ParameterValue');
$this->assertEquals('DummyValue|ecom-t-all-ami-types-42-stack|VarnishAmi', $parameters['VarnishAmi']);
}