Completed
Push — master ( 8878dc...665782 )
by Matthijs
03:00
created

TestCase   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getResource() 0 4 1
A buildResourceFromFixture() 0 7 1
A getFixtureContent() 0 4 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;
13
14
use GuzzleHttp\Psr7\Response;
15
use VDB\Spider\Resource;
16
use VDB\Spider\Uri\DiscoveredUri;
17
use VDB\Uri\Uri;
18
19
/**
20
 *
21
 */
22
class TestCase extends \PHPUnit_Framework_TestCase
23
{
24
    /**
25
     * @param DiscoveredUri $uri
26
     * @param Response $response
27
     * @return Resource
28
     */
29
    protected function getResource(DiscoveredUri $uri, Response $response)
30
    {
31
        return new Resource($uri, $response);
32
    }
33
34
    protected function buildResourceFromFixture($fixturePath, $uriString)
35
    {
36
        return $this->getResource(
37
            new DiscoveredUri(new Uri($uriString)),
38
            new Response(200, [], $this->getFixtureContent($fixturePath))
39
        );
40
    }
41
42
    /**
43
     * @param $filePath /absolute/path/to/fixure
44
     */
45
    protected function getFixtureContent($filePath)
46
    {
47
        return file_get_contents($filePath);
48
    }
49
}
50