Passed
Push — master ( 1c6332...1ba0c5 )
by Jean Paul
06:52
created

WebPageSourceTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 17
dl 0
loc 38
rs 10
c 1
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testSetGetUrl() 0 17 1
A testSetGetHandler() 0 11 1
1
<?php declare( strict_types = 1 );
2
3
namespace Coco\SourceWatcher\Tests\Watcher\Source;
4
5
use Coco\SourceWatcher\Watcher\Handler\WebPageHandler;
6
use Coco\SourceWatcher\Watcher\Source\WebPageSource;
7
use PHPUnit\Framework\TestCase;
8
9
/**
10
 * Class WebPageSourceTest
11
 * @package Coco\SourceWatcher\Tests\Watcher\Source
12
 */
13
class WebPageSourceTest extends TestCase
14
{
15
    /**
16
     *
17
     */
18
    public function testSetGetUrl () : void
19
    {
20
        $givenURL = "http://localhost/";
21
        $expectedURL = "http://localhost/";
22
23
        $webPageSource = new WebPageSource( $givenURL );
24
25
        $this->assertNotNull( $webPageSource->getUrl() );
26
        $this->assertNotEmpty( $webPageSource->getUrl() );
27
        $this->assertEquals( $expectedURL, $webPageSource->getUrl() );
28
29
30
        $webPageSource->setUrl( $givenURL );
31
32
        $this->assertNotNull( $webPageSource->getUrl() );
33
        $this->assertNotEmpty( $webPageSource->getUrl() );
34
        $this->assertEquals( $expectedURL, $webPageSource->getUrl() );
35
    }
36
37
    /**
38
     *
39
     */
40
    public function testSetGetHandler () : void
41
    {
42
        $webPageSource = new WebPageSource( "http://localhost/" );
43
44
        $givenHandler = $this->createMock( WebPageHandler::class );
45
        $expectedHandler = $this->createMock( WebPageHandler::class );
46
47
        $webPageSource->setHandler( $givenHandler );
48
49
        $this->assertNotNull( $webPageSource->getHandler() );
50
        $this->assertEquals( $expectedHandler, $webPageSource->getHandler() );
51
    }
52
}
53