UriWithQueryStringFilterTest::testMatch()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 16
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 12
nc 1
nop 0
dl 0
loc 16
rs 9.8666
c 0
b 0
f 0
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\UriWithQueryStringFilter;
15
use VDB\Spider\Tests\TestCase;
16
use VDB\Uri\Uri;
17
18
/**
19
 *
20
 */
21
class UriWithQueryStringFilterTest extends TestCase
22
{
23
    /**
24
     * @covers VDB\Spider\Filter\Prefetch\UriWithHashFragmentFilter
25
     */
26
    public function testMatch()
27
    {
28
        $filter = new UriWithQueryStringFilter();
29
30
        $currentUri = 'http://php-spider.org';
31
        $uri1 = new Uri('?', $currentUri);
32
        $uri2 = new Uri('?foo=2', $currentUri);
33
        $uri3 = new Uri('http://php-spider.org/foo?bar=baz', $currentUri);
34
        $uri4 = new Uri('http://php-spider.org/foo/?bar=baz', $currentUri);
35
        $uri5 = new Uri('http://php-spider.org?/foo/bar', $currentUri);
36
37
        $this->assertTrue($filter->match($uri1), '->match(\'?\')');
38
        $this->assertTrue($filter->match($uri2));
39
        $this->assertTrue($filter->match($uri3));
40
        $this->assertTrue($filter->match($uri4));
41
        $this->assertTrue($filter->match($uri5));
42
    }
43
}
44