Passed
Branch feature/cleanup (2bd333)
by Matthijs
06:03
created

DiscovererSetTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 8 1
A testFilter() 0 5 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\Discoverer;
13
14
use VDB\Spider\Discoverer\XPathExpressionDiscoverer;
15
use VDB\Spider\Discoverer\DiscovererSet;
16
use VDB\Spider\Filter\Prefetch\UriFilter;
17
18
/**
19
 *
20
 */
21
class DiscovererSetTest extends DiscovererTestCase
22
{
23
    private $discovererSet;
24
25
26
    public function setUp()
27
    {
28
        parent::setUp();
29
30
        $this->discovererSet = new DiscovererSet();
31
        $this->discovererSet->set(new XPathExpressionDiscoverer("//a"));
32
        $this->discovererSet->addFilter(new UriFilter(['/^.*contact.*$/']));
33
    }
34
35
    /**
36
     * @covers VDB\Spider\Discoverer\DiscovererSet::filter()
37
     * @covers VDB\Spider\Filter\Prefetch\UriFilter::match()
38
     */
39
    public function testFilter()
40
    {
41
        $uris = $this->discovererSet->discover($this->spiderResource);
42
        $this->assertCount(0, $uris);
43
    }
44
}
45