| @@ 7-37 (lines=31) @@ | ||
| 4 | use PHPUnit\Framework\TestCase; |
|
| 5 | use Robo\Traits\TestTasksTrait; |
|
| 6 | ||
| 7 | class CleanDirTest extends TestCase |
|
| 8 | { |
|
| 9 | use TestTasksTrait; |
|
| 10 | use Task\Filesystem\loadTasks; |
|
| 11 | ||
| 12 | protected $fixtures; |
|
| 13 | ||
| 14 | public function setUp() |
|
| 15 | { |
|
| 16 | $this->fixtures = new Fixtures(); |
|
| 17 | $this->initTestTasksTrait(); |
|
| 18 | } |
|
| 19 | ||
| 20 | public function tearDown() |
|
| 21 | { |
|
| 22 | $this->fixtures->cleanup(); |
|
| 23 | } |
|
| 24 | ||
| 25 | public function testCleanDir() |
|
| 26 | { |
|
| 27 | $this->fixtures->createAndCdToSandbox(); |
|
| 28 | ||
| 29 | $this->assertFileExists('box/robo.txt'); |
|
| 30 | $result = $this->taskCleanDir(['box']) |
|
| 31 | ->run(); |
|
| 32 | $this->assertTrue($result->wasSuccessful()); |
|
| 33 | $this->assertFileNotExists('box/robo.txt'); |
|
| 34 | $this->assertFileExists('a.txt'); |
|
| 35 | } |
|
| 36 | ||
| 37 | } |
|
| 38 | ||
| @@ 7-38 (lines=32) @@ | ||
| 4 | use PHPUnit\Framework\TestCase; |
|
| 5 | use Robo\Traits\TestTasksTrait; |
|
| 6 | ||
| 7 | class DeleteDirTest extends TestCase |
|
| 8 | { |
|
| 9 | use TestTasksTrait; |
|
| 10 | use Task\Filesystem\loadTasks; |
|
| 11 | ||
| 12 | protected $fixtures; |
|
| 13 | ||
| 14 | public function setUp() |
|
| 15 | { |
|
| 16 | $this->fixtures = new Fixtures(); |
|
| 17 | $this->initTestTasksTrait(); |
|
| 18 | } |
|
| 19 | ||
| 20 | public function tearDown() |
|
| 21 | { |
|
| 22 | $this->fixtures->cleanup(); |
|
| 23 | } |
|
| 24 | ||
| 25 | public function testDeleteDir() |
|
| 26 | { |
|
| 27 | $this->fixtures->createAndCdToSandbox(); |
|
| 28 | ||
| 29 | $this->assertFileExists('box'); |
|
| 30 | $this->assertFileExists('box/robo.txt'); |
|
| 31 | $result = $this->taskDeleteDir(['box']) |
|
| 32 | ->run(); |
|
| 33 | $this->assertTrue($result->wasSuccessful()); |
|
| 34 | $this->assertFileNotExists('box'); |
|
| 35 | $this->assertFileNotExists('box/robo.txt'); |
|
| 36 | } |
|
| 37 | ||
| 38 | } |
|
| 39 | ||