Completed
Push — master ( 64491b...1f7f5f )
by Jan-Petter
30:57
created

NoneTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 39
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 0
cbo 2
dl 39
loc 39
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testNone() 9 9 1
A generateDataForTest() 14 14 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
namespace vipnytt\XRobotsTagParser\Tests;
4
5
use vipnytt\XRobotsTagParser;
6
7 View Code Duplication
class NoneTest extends \PHPUnit_Framework_TestCase
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
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