Code Duplication    Length = 19-27 lines in 4 locations

Tests/Functional/CleanCode/MethodOneTryCatchTest.php 1 location

@@ 12-38 (lines=27) @@
9
 *
10
 * @package MS\PHPMD\Tests\Functional\CleanCode
11
 */
12
class MethodOneTryCatchTest extends AbstractProcessTest
13
{
14
    /**
15
     * @covers MS\PHPMD\Rule\CleanCode\MethodOneTryCatch
16
     */
17
    public function testMethodOneTryCatchRule()
18
    {
19
        $output = $this
20
            ->runPhpmd('Utility/TryThings.php', 'cleancode.xml')
21
            ->getOutput();
22
23
        $this->assertContains('Utility/TryThings.php:39	This method contains more than one try statement. Swap out the try statement in an extra method. It increase the readability.', $output);
24
        $this->assertContains('Utility/TryThings.php:53	This method contains more than one try statement. Swap out the try statement in an extra method. It increase the readability.', $output);
25
    }
26
27
    /**
28
     * @covers MS\PHPMD\Rule\CleanCode\MethodOneTryCatch
29
     */
30
    public function testRuleWithoutTry()
31
    {
32
        $output = $this
33
            ->runPhpmd('Entity.php', 'cleancode.xml')
34
            ->getOutput();
35
36
        $this->assertEmpty(trim($output));
37
    }
38
}
39

Tests/Functional/CleanCode/SuperfluousCommentTest.php 1 location

@@ 12-30 (lines=19) @@
9
 *
10
 * @package MS\PHPMD\Tests\Functional\CleanCode
11
 */
12
class SuperfluousCommentTest extends AbstractProcessTest
13
{
14
    /**
15
     * @covers MS\PHPMD\Rule\CleanCode\SuperfluousComment
16
     */
17
    public function testSuperfluousCommentRule()
18
    {
19
        $output = $this
20
            ->runPhpmd('Service/SuperfluousComment.php', 'cleancode.xml')
21
            ->getOutput();
22
23
        $this->assertNotContains('SuperfluousComment.php:42	It seems', $output);
24
25
        $this->assertContains('SuperfluousComment.php:10	It seems that the class has a superfluous comment description. It fits 88 percent with the name of that.', $output);
26
        $this->assertContains('SuperfluousComment.php:10	It seems that the property $name has a superfluous comment description. It fits 73 percent with the name of that.', $output);
27
        $this->assertContains('SuperfluousComment.php:24	It seems that the method has a superfluous comment description. It fits 100 percent with the name of that.', $output);
28
        $this->assertContains('SuperfluousComment.php:34	It seems that the method has a superfluous comment description. It fits 82 percent with the name of that.', $output);
29
    }
30
}
31

Tests/Functional/Test/MethodNameUnderstandableTest.php 1 location

@@ 12-30 (lines=19) @@
9
 *
10
 * @package MS\PHPMD\Tests\Functional\Test
11
 */
12
class MethodNameUnderstandableTest extends AbstractProcessTest
13
{
14
    /**
15
     * @covers MS\PHPMD\Rule\Test\MethodNameUnderstandable
16
     * @covers MS\PHPMD\Rule\Test\AbstractTestRule
17
     */
18
    public function testMethodNameUnderstandableRule()
19
    {
20
        $output = $this
21
            ->runPhpmd('Tests/Test.php', 'test.xml')
22
            ->getOutput();
23
24
        $this->assertNotContains('Test.php:13', $output);
25
        $this->assertNotContains('Test.php:25', $output);
26
27
        $this->assertContains('Test.php:37	Only 1 words are found in the method name. Try to describe your code as good as you can with 3 or more words.', $output);
28
        $this->assertContains('Test.php:52	Only 1 words are found in the method name. Try to describe your code as good as you can with 3 or more words.', $output);
29
    }
30
}
31

Tests/Functional/Symfony2/ControllerMethodNameTest.php 1 location

@@ 12-38 (lines=27) @@
9
 *
10
 * @package PHPMD\Tests\Functional\Symfony2
11
 */
12
class ControllerMethodNameTest extends AbstractProcessTest
13
{
14
    /**
15
     * @covers MS\PHPMD\Rule\Symfony2\ControllerMethodName
16
     */
17
    public function testControllerMethodNameRule()
18
    {
19
        $output = $this
20
            ->runPhpmd('Controller/FooController.php', 'symfony2.xml')
21
            ->getOutput();
22
23
        $this->assertNotContains('Controller/FooController.php:18	The method name should end with Action in this controller.', $output);
24
        $this->assertContains('Controller/FooController.php:33	The method name should end with Action in this controller.', $output);
25
    }
26
27
    /**
28
     * @covers MS\PHPMD\Rule\Symfony2\ControllerMethodName
29
     */
30
    public function testRuleWithAbstractClass()
31
    {
32
        $output = $this
33
            ->runPhpmd('Controller/AbstractFooController.php', 'symfony2.xml')
34
            ->getOutput();
35
36
        $this->assertEmpty(trim($output));
37
    }
38
}
39