RestrictToBaseUriFilterTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 21
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A matchURIProvider() 0 6 1
A testMatch() 0 7 1
1
<?php
2
3
/*
4
 * This file is part of the Spider package.
5
 *
6
 * (c) Matthijs van den Bos <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace VDB\Spider\Tests\Filter\Prefetch;
13
14
use VDB\Spider\Filter\Prefetch\RestrictToBaseUriFilter;
15
use VDB\Spider\Tests\TestCase;
16
use VDB\Uri\Uri;
17
18
/**
19
 *
20
 */
21
class RestrictToBaseUriFilterTest extends TestCase
22
{
23
    /**
24
     * @covers VDB\Spider\Filter\Prefetch\RestrictToBaseUriFilter
25
     * @dataProvider matchURIProvider
26
     */
27
    public function testMatch($href, $expected)
28
    {
29
        $filter = new RestrictToBaseUriFilter('http://php-spider.org');
30
31
        $uri = new Uri($href);
32
33
        $this->assertEquals($expected, $filter->match($uri));
34
    }
35
36
    public function matchURIProvider()
37
    {
38
        return array(
39
            array('http://example.org', true),
40
            array('http://php-spider.org', false),
41
            array('http://blog.php-spider.org', true),
42
43
        );
44
    }
45
}
46