Passed
Push — html ( 51e1ba...d230bc )
by Peter
02:59
created

ContentlessTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 33
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A testToStringIsEmptyByDefault() 0 5 1
A testSetContentDoesNotThrowExceptionIfCalledWithNull() 0 7 1
A testSetContentThrowsExceptionIfCalledWithNotNull() 0 7 1
A createContentless() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace AbterPhp\Framework\Html;
6
7
use PHPUnit\Framework\TestCase;
8
9
class ContentlessTest extends TestCase
10
{
11
    public function testToStringIsEmptyByDefault(): void
12
    {
13
        $sut = $this->createContentless();
14
15
        $this->assertStringContainsString('', (string)$sut);
16
    }
17
18
    public function testSetContentThrowsExceptionIfCalledWithNotNull(): void
19
    {
20
        $this->expectException(\LogicException::class);
21
22
        $sut = $this->createContentless();
23
24
        $sut->setContent(12);
25
    }
26
27
    public function testSetContentDoesNotThrowExceptionIfCalledWithNull(): void
28
    {
29
        $sut = $this->createContentless();
30
31
        $actual = $sut->setContent(null);
32
33
        $this->assertSame($sut, $actual);
34
    }
35
36
    /**
37
     * @return Contentless
38
     */
39
    protected function createContentless(): INode
40
    {
41
        return new Contentless();
42
    }
43
}
44