/** * @test */ public function withAdditionalDirectoriesAndApplicationRootCreatesCorrectLinks() { $dataPath = '../../../../shared/Data'; $expectedCommands = array("cd '/releases/current/app/dir'", "{ [ -d {$dataPath}/fileadmin ] || mkdir -p {$dataPath}/fileadmin ; }", "{ [ -d {$dataPath}/uploads ] || mkdir -p {$dataPath}/uploads ; }", "ln -sf {$dataPath}/fileadmin ./fileadmin", "ln -sf {$dataPath}/uploads ./uploads", "{ [ -d '{$dataPath}/pictures' ] || mkdir -p '{$dataPath}/pictures' ; }", "ln -sf '{$dataPath}/pictures' 'pictures'", "{ [ -d '{$dataPath}/test/assets' ] || mkdir -p '{$dataPath}/test/assets' ; }", "ln -sf '../{$dataPath}/test/assets' 'test/assets'"); $options = array('applicationRootDirectory' => 'app/dir/', 'directories' => array('pictures', 'test/assets')); $this->shellMock->expects($this->once())->method('executeOrSimulate')->with($expectedCommands, $this->nodeMock, $this->deploymentMock); $this->task->execute($this->nodeMock, $this->applicationMock, $this->deploymentMock, $options); }
/** * @test */ public function withAdditionalDirectoriesAndApplicationRootCreatesCorrectLinks() { $options = array('applicationRootDirectory' => 'app/dir/', 'directories' => array('pictures', 'test/assets')); $this->task->execute($this->node, $this->application, $this->deployment, $options); $dataPath = '../../../../shared/Data'; $this->assertCommandExecuted("cd '{$this->deployment->getApplicationReleasePath($this->application)}/app/dir'"); $this->assertCommandExecuted("{ [ -d {$dataPath}/fileadmin ] || mkdir -p {$dataPath}/fileadmin ; }"); $this->assertCommandExecuted("{ [ -d {$dataPath}/uploads ] || mkdir -p {$dataPath}/uploads ; }"); $this->assertCommandExecuted("ln -sf {$dataPath}/fileadmin ./fileadmin"); $this->assertCommandExecuted("ln -sf {$dataPath}/uploads ./uploads"); $this->assertCommandExecuted("{ [ -d '{$dataPath}/pictures' ] || mkdir -p '{$dataPath}/pictures' ; }"); $this->assertCommandExecuted("ln -sf '{$dataPath}/pictures' 'pictures'"); $this->assertCommandExecuted("{ [ -d '{$dataPath}/test/assets' ] || mkdir -p '{$dataPath}/test/assets' ; }"); $this->assertCommandExecuted("ln -sf '../{$dataPath}/test/assets' 'test/assets'"); }