EventPageTest::testGetCrawlerHtml()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 4

Duplication

Lines 9
Ratio 100 %

Importance

Changes 0
Metric Value
dl 9
loc 9
c 0
b 0
f 0
rs 9.6666
cc 1
eloc 4
nc 1
nop 0
1
<?php
2
3
namespace Sportic\Timing\RaceTecClient\Tests\Scrapers;
4
5
use PHPUnit\Framework\TestCase;
6
use Sportic\Timing\RaceTecClient\Scrapers\EventPage;
7
use Symfony\Component\DomCrawler\Crawler;
8
9
/**
10
 * Class EventPageTest
11
 * @package Sportic\Timing\RaceTecClient\Tests\Scrapers
12
 */
13 View Code Duplication
class EventPageTest extends TestCase
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
14
{
15
    public function testGetCrawlerUri()
16
    {
17
        $crawler = $this->getCrawler();
18
19
        static::assertInstanceOf(Crawler::class, $crawler);
20
21
        static::assertSame(
22
            'http://cronometraj.racetecresults.com/Results.aspx?CId=16648&RId=2091&EId=1',
23
            $crawler->getUri()
24
        );
25
    }
26
27
    public function testGetCrawlerHtml()
28
    {
29
        $crawler = $this->getCrawler();
30
31
        static::assertInstanceOf(Crawler::class, $crawler);
32
33
        static::assertContains('Marius-Alexandru Dragu', $crawler->html());
34
//        file_put_contents(TEST_FIXTURE_PATH . '/Parsers/event_page.html', $crawler->html());
0 ignored issues
show
Unused Code Comprehensibility introduced by
53% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
35
    }
36
37
    /**
38
     * @return Crawler
39
     */
40
    protected function getCrawler()
41
    {
42
        $scraper = new EventPage('16648', '2091', '1');
43
44
        return $scraper->getCrawler();
45
    }
46
}
47