Code Duplication    Length = 25-26 lines in 2 locations

tests/RobotsManagerTest.php 2 locations

@@ 48-72 (lines=25) @@
45
        $this->assertStringContainsString('Host: '.$host, $robots->generate());
46
    }
47
48
    public function testaddDisallow(): void
49
    {
50
        $robots = new RobotsManager;
51
        $path = '/dir/';
52
        $paths = ['/dir-1/', '/dir-2/', '/dir-3/'];
53
54
        // Test a single path.
55
        $this->assertStringNotContainsString('Disallow: '.$path, $robots->generate());
56
        $robots->addDisallow($path);
57
        $this->assertStringContainsString('Disallow: '.$path, $robots->generate());
58
59
        // Test array of paths.
60
        foreach ($paths as $path_test) {
61
            $this->assertStringNotContainsString('Disallow: '.$path_test, $robots->generate());
62
        }
63
64
        // Add the array of paths
65
        $robots->addDisallow($paths);
66
67
        // Check the old path is still there
68
        $this->assertStringContainsString('Disallow: '.$path, $robots->generate());
69
        foreach ($paths as $path_test) {
70
            $this->assertStringContainsString('Disallow: '.$path_test, $robots->generate());
71
        }
72
    }
73
74
    public function testaddAllow(): void
75
    {
@@ 74-99 (lines=26) @@
71
        }
72
    }
73
74
    public function testaddAllow(): void
75
    {
76
        $robots = new RobotsManager;
77
        $path = '/dir/';
78
        $paths = ['/dir-1/', '/dir-2/', '/dir-3/'];
79
80
        // Test a single path.
81
        $this->assertStringNotContainsString('Allow: '.$path, $robots->generate());
82
        $robots->addAllow($path);
83
        $this->assertStringContainsString('Allow: '.$path, $robots->generate());
84
85
        // Test array of paths.
86
        foreach ($paths as $path_test) {
87
            $this->assertStringNotContainsString('Allow: '.$path_test, $robots->generate());
88
        }
89
90
        // Add the array of paths
91
        $robots->addAllow($paths);
92
93
        // Check the old path is still there
94
        $this->assertStringContainsString('Allow: '.$path, $robots->generate());
95
96
        foreach ($paths as $path_test) {
97
            $this->assertStringContainsString('Allow: '.$path_test, $robots->generate());
98
        }
99
    }
100
101
    public function testaddComment(): void
102
    {