TestCase   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 26
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A buildResourceFromFixture() 0 5 1
A getResource() 0 3 1
A getFixtureContent() 0 3 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
use PHPUnit\Framework\TestCase as PHPUnitTestCase;
20
21
/**
22
 *
23
 */
24
class TestCase extends PHPUnitTestCase
25
{
26
    /**
27
     * @param DiscoveredUri $uri
28
     * @param Response $response
29
     * @return Resource
30
     */
31
    protected function getResource(DiscoveredUri $uri, Response $response)
32
    {
33
        return new Resource($uri, $response);
34
    }
35
36
    protected function buildResourceFromFixture($fixturePath, $uriString)
37
    {
38
        return $this->getResource(
39
            new DiscoveredUri(new Uri($uriString)),
40
            new Response(200, [], $this->getFixtureContent($fixturePath))
41
        );
42
    }
43
44
    /**
45
     * @param $filePath /absolute/path/to/fixure
0 ignored issues
show
Documentation Bug introduced by Matthijs van den Bos
The doc comment /absolute/path/to/fixure at position 0 could not be parsed: Unknown type name '/absolute/path/to/fixure' at position 0 in /absolute/path/to/fixure.
Loading history...
46
     */
47
    protected function getFixtureContent($filePath)
48
    {
49
        return file_get_contents($filePath);
50
    }
51
}
52