Completed
Push — master ( 75054d...9702ee )
by Jan-Petter
04:01
created

InvalidURLTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testInvalidURL() 0 10 1
A generateDataForTest() 0 13 1
1
<?php
2
3
namespace vipnytt\CleanParamFilter\Tests;
4
5
use vipnytt\CleanParamFilter;
6
7
class InvalidURLTest extends \PHPUnit_Framework_TestCase
8
{
9
    /**
10
     * Basic usage test
11
     *
12
     * @dataProvider generateDataForTest
13
     * @param array $urls
14
     * @return void
15
     */
16
    public function testInvalidURL($urls)
17
    {
18
        $filter = new CleanParamFilter($urls);
19
        $this->assertInstanceOf('vipnytt\CleanParamFilter', $filter);
20
21
        // Invalid URLs
22
        $this->assertContains('http:/example.tld/', $filter->listInvalid());
23
        $this->assertNotContains('http:/example.tld/', $filter->listApproved());
24
        $this->assertNotContains('http:/example.tld/', $filter->listDuplicate());
25
    }
26
27
    /**
28
     * Generate test case data
29
     * @return array
30
     */
31
    public function generateDataForTest()
32
    {
33
        return array(
34
            array(
35
                array(
36
                    'http:/example.tld/',
37
                    'http://example.com/',
38
                    'http://example.com/?ref=somewhere2',
39
                    'http://example.com/?ref=somewhere3?'
40
                )
41
            )
42
        );
43
    }
44
}
45