Code Duplication    Length = 39-39 lines in 2 locations

tests/NoindexTest.php 1 location

@@ 7-45 (lines=39) @@
4
5
use vipnytt\XRobotsTagParser;
6
7
class NoindexTest extends \PHPUnit_Framework_TestCase
8
{
9
    /**
10
     * noindex test
11
     *
12
     * @dataProvider generateDataForTest
13
     * @param string $url
14
     * @param string $bot
15
     * @param array $options
16
     */
17
    public function testNoIndex($url, $bot, $options)
18
    {
19
        $parser = new XRobotsTagParser($url, $bot, $options);
20
        $this->assertInstanceOf('vipnytt\XRobotsTagParser', $parser);
21
22
        $this->assertTrue($parser->getRules(true)['noindex']);
23
        $this->assertTrue($parser->getRules(false)['noindex']);
24
        $this->assertTrue($parser->getRules(false)['noarchive']);
25
    }
26
27
    /**
28
     * Generate test data
29
     * @return array
30
     */
31
    public function generateDataForTest()
32
    {
33
        return [
34
            [
35
                'http://example.com/',
36
                'googlebot',
37
                ['headers' =>
38
                    [
39
                        'X-Robots-Tag: noindex'
40
                    ]
41
                ]
42
            ]
43
        ];
44
    }
45
}
46

tests/NoneTest.php 1 location

@@ 7-45 (lines=39) @@
4
5
use vipnytt\XRobotsTagParser;
6
7
class NoneTest extends \PHPUnit_Framework_TestCase
8
{
9
    /**
10
     * none test
11
     *
12
     * @dataProvider generateDataForTest
13
     * @param string $url
14
     * @param string $bot
15
     * @param array $options
16
     */
17
    public function testNone($url, $bot, $options)
18
    {
19
        $parser = new XRobotsTagParser($url, $bot, $options);
20
        $this->assertInstanceOf('vipnytt\XRobotsTagParser', $parser);
21
22
        $this->assertTrue($parser->getRules(true)['none']);
23
        $this->assertTrue($parser->getRules(false)['noindex']);
24
        $this->assertTrue($parser->getRules(false)['nofollow']);
25
    }
26
27
    /**
28
     * Generate test data
29
     * @return array
30
     */
31
    public function generateDataForTest()
32
    {
33
        return [
34
            [
35
                'http://example.com/',
36
                'googlebot',
37
                ['headers' =>
38
                    [
39
                        'X-Robots-Tag: none'
40
                    ]
41
                ]
42
            ]
43
        ];
44
    }
45
}
46