/** * method deploy * when called * should installRequirementsAndDeploy */ public function test_deploy_called_installRequirementsAndDeploy() { $sut = new DeployService('staging', __DIR__ . '/playbook'); $sut->deploy('master', ' -p /tmp/roles'); self::assertFileExists('/tmp/roles/kbrebanov.docker'); self::assertStringEqualsFile('/tmp/deploytest.txt', "test\n"); }
/** * method deploy * when called * should installRequirementsAndCallDeployPlaybook */ public function test_deploy_called_installRequirements() { $command_requirements = new Command('ansible-galaxy install -r ' . self::PLAYBOOK_FOLDER . '/requirements.yml'); $command_deploy = new Command('ansible-playbook -i ' . self::PLAYBOOK_FOLDER . '/' . self::ENVIRONMENT . ' ' . self::PLAYBOOK_FOLDER . '/deploy.yml'); $exec_double = $this->prophesize('AdamBrett\\ShellWrapper\\Runners\\Exec'); $exec_double->run($command_requirements)->shouldBeCalled(); $exec_double->run($command_deploy)->shouldBeCalled(); $sut = new DeployService(self::ENVIRONMENT, self::PLAYBOOK_FOLDER, $exec_double->reveal()); $sut->deploy('master'); }