Code Duplication    Length = 35-35 lines in 2 locations

test/Exercise/ConcernedAboutSeparationTest.php 1 location

@@ 56-90 (lines=35) @@
53
        $this->assertNull($e->tearDown());
54
    }
55
56
    public function testGetArgsCreatesFilesAndReturnsRandomExt()
57
    {
58
        $e = new ConcernedAboutSeparation($this->filesystem, $this->faker, $this->parser);
59
        $args = $e->getArgs();
60
        $path = $args[0];
61
        $this->assertFileExists($path);
62
63
        $files = [
64
            "learnyouphp.dat",
65
            "learnyouphp.txt",
66
            "learnyouphp.sql",
67
            "api.html",
68
            "README.md",
69
            "CHANGELOG.md",
70
            "LICENCE.md",
71
            "md",
72
            "data.json",
73
            "data.dat",
74
            "words.dat",
75
            "w00t.dat",
76
            "w00t.txt",
77
            "wrrrrongdat",
78
            "dat",
79
        ];
80
81
        array_walk($files, function ($file) use ($path) {
82
            $this->assertFileExists(sprintf('%s/%s', $path, $file));
83
        });
84
85
        $extensions = array_unique(array_map(function ($file) {
86
            return pathinfo($file, PATHINFO_EXTENSION);
87
        }, $files));
88
89
        $this->assertTrue(in_array($args[1], $extensions));
90
    }
91
92
    public function testTearDownRemovesFile()
93
    {

test/Exercise/FilteredLsTest.php 1 location

@@ 40-74 (lines=35) @@
37
        $this->assertNull($e->tearDown());
38
    }
39
40
    public function testGetArgsCreatesFilesAndReturnsRandomExt()
41
    {
42
        $e = new FilteredLs($this->filesystem);
43
        $args = $e->getArgs();
44
        $path = $args[0];
45
        $this->assertFileExists($path);
46
47
        $files = [
48
            "learnyouphp.dat",
49
            "learnyouphp.txt",
50
            "learnyouphp.sql",
51
            "api.html",
52
            "README.md",
53
            "CHANGELOG.md",
54
            "LICENCE.md",
55
            "md",
56
            "data.json",
57
            "data.dat",
58
            "words.dat",
59
            "w00t.dat",
60
            "w00t.txt",
61
            "wrrrrongdat",
62
            "dat",
63
        ];
64
65
        array_walk($files, function ($file) use ($path) {
66
            $this->assertFileExists(sprintf('%s/%s', $path, $file));
67
        });
68
69
        $extensions = array_unique(array_map(function ($file) {
70
            return pathinfo($file, PATHINFO_EXTENSION);
71
        }, $files));
72
73
        $this->assertTrue(in_array($args[1], $extensions));
74
    }
75
76
    public function testTearDownRemovesFile()
77
    {