Code Duplication    Length = 17-19 lines in 4 locations

tests/integration/CollectionTest.php 2 locations

@@ 32-50 (lines=19) @@
29
        $this->fixtures->cleanup();
30
    }
31
32
    public function testSimulateDirCreation()
33
    {
34
        // Set up a collection to add tasks to
35
        $collection = $this->collectionBuilder();
36
        $collection->simulated(true);
37
38
        // Set up a filesystem stack
39
        $collection->taskFilesystemStack()
40
            ->mkdir('simulatedir')
41
            ->touch('simulatedir/error.txt');
42
43
        // Run the task collection; the files would be present were this
44
        // operation not simulated.
45
        $result = $collection->run();
46
        $this->assertTrue($result->wasSuccessful());
47
        // Nothing should be created in simulated mode
48
        $this->assertFileNotExists('simulatedir/error.txt');
49
        $this->assertOutputContains('[Simulator] Simulating Filesystem\FilesystemStack()');
50
    }
51
52
53
    public function testRunMultipleTasksViaACollectionBuilder()
@@ 313-331 (lines=19) @@
310
        $this->assertEquals($expected_order, $actual_order);
311
    }
312
313
    public function testCreateDirViaCollection()
314
    {
315
        // Set up a collection to add tasks to
316
        $collection = $this->collectionBuilder();
317
318
        // Set up a filesystem stack
319
        $collection->taskFilesystemStack()
320
            ->mkdir('log')
321
            ->touch('log/error.txt');
322
323
        // FilesystemStack has not run yet, so file should not be found.
324
        $this->assertFileNotExists('log/error.txt');
325
326
        // Run the task collection; now the files should be present
327
        $result = $collection->run();
328
        $this->assertTrue($result->wasSuccessful(), $result->getMessage());
329
        $this->assertFileExists('log/error.txt');
330
        $this->assertFileExists('log');
331
    }
332
333
    public function testUseATmpDirAndConfirmItIsDeleted()
334
    {

tests/integration/FilesystemStackTest.php 1 location

@@ 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(), $result->getMessage());
42
        $this->assertFileExists('simulatedir/error.txt');
43
    }
44
45
    public function testCreateDir()
46
    {

tests/integration/SimulatedTest.php 1 location

@@ 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(), $result->getMessage());
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