Code Duplication    Length = 15-17 lines in 4 locations

tests/php/PHPMD/PHPMDTest.php 2 locations

@@ 122-138 (lines=17) @@
119
     *
120
     * @return void
121
     */
122
    public function testHasViolationsReturnsFalseForSourceWithoutViolations()
123
    {
124
        self::changeWorkingDirectory();
125
126
        $renderer = new XMLRenderer();
127
        $renderer->setWriter(new WriterStub());
128
129
        $phpmd = new PHPMD();
130
        $phpmd->processFiles(
131
            self::createFileUri('source/source_without_violations.php'),
132
            'pmd-refset1',
133
            array($renderer),
134
            new RuleSetFactory()
135
        );
136
137
        $this->assertFalse($phpmd->hasViolations());
138
    }
139
140
    /**
141
     * testHasViolationsReturnsTrueForSourceWithViolation
@@ 145-161 (lines=17) @@
142
     *
143
     * @return void
144
     */
145
    public function testHasViolationsReturnsTrueForSourceWithViolation()
146
    {
147
        self::changeWorkingDirectory();
148
149
        $renderer = new XMLRenderer();
150
        $renderer->setWriter(new WriterStub());
151
152
        $phpmd = new PHPMD();
153
        $phpmd->processFiles(
154
            self::createFileUri('source/source_with_npath_violation.php'),
155
            'pmd-refset1',
156
            array($renderer),
157
            new RuleSetFactory()
158
        );
159
160
        $this->assertTrue($phpmd->hasViolations());
161
    }
162
}
163

tests/php/PHPMD/Regression/AcceptsFilesAndDirectoriesAsInputTicket001Test.php 2 locations

@@ 37-51 (lines=15) @@
34
     *
35
     * @return void
36
     */
37
    public function testCliAcceptsDirectoryAsInput()
38
    {
39
        self::changeWorkingDirectory();
40
41
        $renderer = new XMLRenderer();
42
        $renderer->setWriter(new WriterStub());
43
44
        $phpmd = new PHPMD();
45
        $phpmd->processFiles(
46
            self::createFileUri('source'),
47
            'pmd-refset1',
48
            array($renderer),
49
            new RuleSetFactory()
50
        );
51
    }
52
53
    /**
54
     * testCliAcceptsSingleFileAsInput
@@ 58-72 (lines=15) @@
55
     *
56
     * @return void
57
     */
58
    public function testCliAcceptsSingleFileAsInput()
59
    {
60
        self::changeWorkingDirectory();
61
62
        $renderer = new XMLRenderer();
63
        $renderer->setWriter(new WriterStub());
64
65
        $phpmd = new PHPMD();
66
        $phpmd->processFiles(
67
            self::createFileUri('source/FooBar.php'),
68
            'pmd-refset1',
69
            array($renderer),
70
            new RuleSetFactory()
71
        );
72
    }
73
}
74