Passed
Push — master ( 20e19d...2ff9a4 )
by Jean Paul
07:10
created

StackOverflowWebPageSourceTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 13
c 2
b 0
f 0
dl 0
loc 24
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testGetResults() 0 9 1
A testGetResultsChangeUrlAfterInstance() 0 11 1
1
<?php
2
3
namespace Coco\SourceWatcher\Tests\Vendors\StackOverflow;
4
5
use Coco\SourceWatcher\Vendors\StackOverflow\StackOverflowWebPageSource;
6
use PHPUnit\Framework\TestCase;
7
8
class StackOverflowWebPageSourceTest extends TestCase
9
{
10
    public function testGetResults () : void
11
    {
12
        $url = "https://stackoverflow.com/jobs?q=PHP&l=Florida+USA&d=100&u=Miles";
13
14
        $webPageSource = new StackOverflowWebPageSource( $url );
15
16
        $results = $webPageSource->getResults();
17
        $this->assertNotNull( $results );
18
        $this->assertNotEmpty( $results );
19
    }
20
21
    public function testGetResultsChangeUrlAfterInstance () : void
22
    {
23
        $url = "https://stackoverflow.com/jobs?q=PHP&l=Florida+USA&d=100&u=Miles";
24
        $webPageSource = new StackOverflowWebPageSource( $url );
25
26
        $url = "https://stackoverflow.com/jobs?q=Java&l=Florida+USA&d=100&u=Miles";
27
        $webPageSource->setUrl( $url );
28
29
        $results = $webPageSource->getResults();
30
        $this->assertNotNull( $results );
31
        $this->assertNotEmpty( $results );
32
    }
33
}
34