Test Setup Failed
Push — master ( b97929...aafad9 )
by Gabriel
02:07
created

AbstractPageTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 57
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 1
lcom 1
cbo 3
dl 0
loc 57
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A setUpBeforeClass() 0 22 1
getSerializedFile() 0 1 ?
getHtmlFile() 0 1 ?
getNewScraper() 0 1 ?
getNewParser() 0 1 ?
1
<?php
2
3
namespace Sportic\Timing\RaceTecClient\Tests\Parsers;
4
5
use PHPUnit\Framework\TestCase;
6
use Sportic\Timing\RaceTecClient\Scrapers\AbstractScraper;
7
use Sportic\Timing\RaceTecClient\Parsers\EventPage as EventPageParser;
8
use Symfony\Component\DomCrawler\Crawler;
9
10
/**
11
 * Class AbstractPageTest
12
 * @package Sportic\Timing\RaceTecClient\Tests\Scrapers
13
 */
14
abstract class AbstractPageTest extends TestCase
15
{
16
    protected static $parameters;
17
18
    /**
19
     * @var EventPageParser
20
     */
21
    protected static $parser;
22
23
    /**
24
     * @var array
25
     */
26
    protected static $parametersParsed;
27
28
    public static function setUpBeforeClass()
29
    {
30
        self::$parameters = unserialize(
31
            file_get_contents(TEST_FIXTURE_PATH . DS . 'Parsers' . DS . static::getSerializedFile())
32
        );
33
34
        $scrapper = static::getNewScraper();
35
36
        $crawler = new Crawler(null, $scrapper->getCrawlerUri());
37
        $crawler->addContent(
38
            file_get_contents(
39
                TEST_FIXTURE_PATH . DS . 'Parsers' . DS . static::getHtmlFile()
40
            ),
41
            'text/html;charset=utf-8'
42
        );
43
44
        self::$parser = static::getNewParser();
0 ignored issues
show
Documentation Bug introduced by
It seems like static::getNewParser() of type object<Sportic\Timing\Ra...rapers\AbstractScraper> is incompatible with the declared type object<Sportic\Timing\Ra...ient\Parsers\EventPage> of property $parser.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
45
        self::$parser->setScraper($scrapper);
0 ignored issues
show
Bug introduced by
The method setScraper() does not seem to exist on object<Sportic\Timing\Ra...rapers\AbstractScraper>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
46
        self::$parser->setCrawler($crawler);
0 ignored issues
show
Bug introduced by
The method setCrawler() does not seem to exist on object<Sportic\Timing\Ra...rapers\AbstractScraper>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
47
48
        self::$parametersParsed = self::$parser->getContent();
0 ignored issues
show
Bug introduced by
The method getContent() does not seem to exist on object<Sportic\Timing\Ra...rapers\AbstractScraper>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
49
    }
50
51
    /**
52
     * @return string
53
     */
54
    abstract protected static function getSerializedFile();
55
56
    /**
57
     * @return string
58
     */
59
    abstract protected static function getHtmlFile();
60
61
    /**
62
     * @return AbstractScraper
63
     */
64
    abstract protected static function getNewScraper();
65
66
    /**
67
     * @return AbstractScraper
68
     */
69
    abstract protected static function getNewParser();
70
}
71