diff --git a/tests/DeployTest.php b/tests/DeployTest.php index 1f78387..ba5b837 100644 --- a/tests/DeployTest.php +++ b/tests/DeployTest.php @@ -12,7 +12,7 @@ public function testBasicRun() { $lub = $this->createStub(LagoonUtilityBelt::class); $lub->method("deployEnvironment")->willReturn("testBuildId"); $runnerArgs = new RunnerArgs(); - $deploy = new Deploy($lub, $runnerArgs); + $deploy = new Deploy($lub, $runnerArgs, new DynamicEnvironment(), new DynamicEnvironment()); $this->expectNotToPerformAssertions(); $deploy->run([]); } @@ -37,7 +37,7 @@ public function testNoSubstitutionsInArgs() { $runnerArgs->project = $args['project']; $runnerArgs->environment = $args['environment']; - $deploy = new Deploy($lub, $runnerArgs); + $deploy = new Deploy($lub, $runnerArgs, new DynamicEnvironment()); $deploy->run($args); @@ -68,10 +68,12 @@ public function testStandardTextualSubstitutionsInArgs() { $runnerArgs->project = $args['project']; $runnerArgs->environment = $args['environment']; - $deploy = new Deploy($lub, $runnerArgs); + $dynamicEnv = new DynamicEnvironment(); + + $deploy = new Deploy($lub, $runnerArgs, $dynamicEnv); // Let's set up the basic text subs we want to do - Deploy::setVariable('LAGOON_BACKUPS_DISABLED', "false"); + $dynamicEnv->setVariable('LAGOON_BACKUPS_DISABLED', "false"); $deploy->run($args); diff --git a/tests/StepParentTest.php b/tests/StepParentTest.php index 07b5844..684f642 100644 --- a/tests/StepParentTest.php +++ b/tests/StepParentTest.php @@ -14,9 +14,11 @@ public function testFillDynamicEnvironmentFromEnv() { $envVarVal = uniqid(); putenv(sprintf("%s=%s", $envVarName, $envVarVal)); - StepParent::fillDynamicEnvironmentFromEnv(); + $dynamicEnv = new DynamicEnvironment(); - $this->assertEquals(StepParent::getVariable($envVarName), $envVarVal); + $dynamicEnv->fillDynamicEnvironmentFromEnv(); + + $this->assertEquals($dynamicEnv->getVariable($envVarName), $envVarVal); } @@ -32,12 +34,13 @@ public function testSubstitutions() { $lub = $this->createStub(LagoonUtilityBelt::class); $lub->method("deployEnvironment")->willReturn("testBuildId"); $runnerArgs = new RunnerArgs(); - $deployStep = new Deploy($lub, $runnerArgs); + $dynamicEnv = new DynamicEnvironment(); + $deployStep = new Deploy($lub, $runnerArgs, $dynamicEnv); $toSubString = "this should have {{ something }} here"; $expected = "this should have words here"; - StepParent::setVariable("something", "words"); + $dynamicEnv->setVariable("something", "words"); $this->assertEquals($expected, $deployStep->doTextSubstitutions($toSubString)); @@ -63,9 +66,10 @@ public function testJSONPAYLOADFILL() { // this looks like {"fullrun":"yes"} putenv("JSON_PAYLOAD=eyJmdWxscnVuIjoieWVzIn0="); - StepParent::fillDynamicEnvironmentFromEnv(); + $dynamicEnvironment = new DynamicEnvironment(); + $dynamicEnvironment->fillDynamicEnvironmentFromEnv(); - $this->assertEquals(StepParent::getVariable("fullrun"), "yes"); + $this->assertEquals($dynamicEnvironment->getVariable("fullrun"), "yes"); }