Completed
Pull Request — master (#18)
by Matthijs
03:17
created

ResourceTest::testGetIdentifier()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
c 3
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
namespace VDB\Spider\Tests;
3
4
use Guzzle\Http\Message\Response;
5
use VDB\Spider\Resource;
6
use VDB\Uri\Uri;
7
use VDB\Spider\Uri\DiscoveredUri;
8
9
/**
10
 */
11
class ResourceTest extends TestCase
12
{
13
    /**
14
     * @var Resource
15
     */
16
    protected $resource;
17
18
    protected function setUp()
19
    {
20
        $html = file_get_contents(__DIR__ . '/Fixtures/ResourceTestHTMLResource.html');
21
        $this->resource = new Resource(
22
            new DiscoveredUri(new Uri('/domains/special', 'http://example.org')),
23
            new Response(200, null, $html)
24
        );
25
    }
26
27
    /**
28
     * @covers VDB\Spider\Resource::getCrawler
29
     */
30
    public function testGetCrawler()
31
    {
32
        $this->assertInstanceOf('Symfony\\Component\\DomCrawler\\Crawler', $this->resource->getCrawler());
33
    }
34
35
    /**
36
     * @covers VDB\Spider\Resource::getUri
37
     */
38
    public function testGetUri()
39
    {
40
        $this->assertInstanceOf('VDB\\Spider\\Uri\\DiscoveredUri', $this->resource->getUri());
41
        $this->assertEquals('http://example.org/domains/special', $this->resource->getUri()->toString());
42
    }
43
44
    /**
45
     * @covers VDB\Spider\Resource::getResponse
46
     */
47
    public function testGetResponse()
48
    {
49
        $this->assertInstanceOf('Guzzle\\Http\\Message\\Response', $this->resource->getResponse());
50
    }
51
}
52