| @@ 27-43 (lines=17) @@ | ||
| 24 | $this->fixtures->cleanup(); |
|
| 25 | } |
|
| 26 | ||
| 27 | public function testDirAndFileCreation() |
|
| 28 | { |
|
| 29 | // Set up a collection to add tasks to |
|
| 30 | $collection = $this->collectionBuilder(); |
|
| 31 | ||
| 32 | // Set up a filesystem stack |
|
| 33 | $collection->taskFilesystemStack() |
|
| 34 | ->mkdir('simulatedir') |
|
| 35 | ->touch('simulatedir/error.txt'); |
|
| 36 | ||
| 37 | $this->assertFileNotExists('simulatedir/error.txt'); |
|
| 38 | ||
| 39 | // Run the task collection; the files should be present afterwards |
|
| 40 | $result = $collection->run(); |
|
| 41 | $this->assertTrue($result->wasSuccessful()); |
|
| 42 | $this->assertFileExists('simulatedir/error.txt'); |
|
| 43 | } |
|
| 44 | ||
| 45 | public function testCreateDir() |
|
| 46 | { |
|
| @@ 27-45 (lines=19) @@ | ||
| 24 | $this->fixtures->cleanup(); |
|
| 25 | } |
|
| 26 | ||
| 27 | public function testSimulateDirCreation() |
|
| 28 | { |
|
| 29 | // Set up a collection to add tasks to |
|
| 30 | $collection = $this->collectionBuilder(); |
|
| 31 | $collection->simulated(true); |
|
| 32 | ||
| 33 | // Set up a filesystem stack |
|
| 34 | $collection->taskFilesystemStack() |
|
| 35 | ->mkdir('simulatedir') |
|
| 36 | ->touch('simulatedir/error.txt'); |
|
| 37 | ||
| 38 | // Run the task collection; the files would be present were this |
|
| 39 | // operation not simulated. |
|
| 40 | $result = $collection->run(); |
|
| 41 | $this->assertTrue($result->wasSuccessful()); |
|
| 42 | // Nothing should be created in simulated mode |
|
| 43 | $this->assertFileNotExists('simulatedir/error.txt'); |
|
| 44 | $this->assertOutputContains('[Simulator] Simulating Filesystem\FilesystemStack()'); |
|
| 45 | } |
|
| 46 | ||
| 47 | } |
|
| 48 | ||