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

testSetContentThrowsExceptionIfCalledWithNotNull()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 0
dl 0
loc 7
rs 10
c 0
b 0
f 0
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