-
-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TASK] Add unit test for CreateDirectoriesTask (#372)
- Loading branch information
1 parent
4f09447
commit d2c55d3
Showing
2 changed files
with
59 additions
and
15 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
|
||
namespace TYPO3\Surf\tests\Unit\Task; | ||
|
||
/* | ||
* This file is part of TYPO3 Surf. | ||
* | ||
* For the full copyright and license information, please view the LICENSE.txt | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
use TYPO3\Surf\Domain\Model\Task; | ||
use TYPO3\Surf\Task\CreateDirectoriesTask; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
class CreateDirectoriesTaskTest extends BaseTaskTest | ||
{ | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function executeSuccessfully(): void | ||
{ | ||
$this->task->execute($this->node, $this->application, $this->deployment); | ||
$this->assertCommandExecuted(sprintf('mkdir -p %s', $this->application->getReleasesPath())); | ||
$this->assertCommandExecuted(sprintf('mkdir -p %s', $this->application->getSharedPath())); | ||
$this->assertCommandExecuted(sprintf('mkdir -p %s', $this->deployment->getApplicationReleasePath($this->application))); | ||
$this->assertCommandExecuted(sprintf('cd %s;ln -snf ./%s next', $this->application->getReleasesPath(), $this->deployment->getReleaseIdentifier())); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function rollbackSuccessfully(): void | ||
{ | ||
$this->task->rollback($this->node, $this->application, $this->deployment); | ||
$this->assertCommandExecuted(sprintf('rm %s/next', $this->application->getReleasesPath())); | ||
$this->assertCommandExecuted(sprintf('rm -rf %s', $this->deployment->getApplicationReleasePath($this->application))); | ||
} | ||
|
||
/** | ||
* @return CreateDirectoriesTask | ||
*/ | ||
protected function createTask() | ||
{ | ||
return new CreateDirectoriesTask(); | ||
} | ||
} |