These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | namespace Robo; |
||
3 | |||
4 | use \CliGuy; |
||
5 | |||
6 | class SimulatedCest |
||
7 | { |
||
8 | public function _before(CliGuy $I) |
||
9 | { |
||
10 | $I->amInPath(codecept_data_dir().'sandbox'); |
||
11 | } |
||
12 | |||
13 | View Code Duplication | public function toSimulateDirCreation(CliGuy $I) |
|
0 ignored issues
–
show
|
|||
14 | { |
||
15 | // Set up a collection to add tasks to |
||
16 | $collection = $I->collectionBuilder(); |
||
17 | $collection->simulated(true); |
||
18 | |||
19 | // Set up a filesystem stack |
||
20 | $collection->taskFilesystemStack() |
||
21 | ->mkdir('simulatedir') |
||
22 | ->touch('simulatedir/error.txt'); |
||
23 | |||
24 | // Run the task collection; now the files should be present |
||
25 | $collection->run(); |
||
26 | // Nothing should be created in simulated mode |
||
27 | $I->dontSeeFileFound('simulatedir/error.txt'); |
||
28 | $I->seeInOutput('[Simulator] Simulating Filesystem\FilesystemStack()'); |
||
29 | } |
||
30 | } |
||
31 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.