Passed
Push — master ( 70dd87...6f141b )
by Alexander
08:24
created

BlockTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 18
c 1
b 0
f 0
dl 0
loc 36
rs 10
wmc 3
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Yii\Widgets\Tests;
6
7
use Yiisoft\Yii\Widgets\Block;
8
9
final class BlockTest extends TestCase
10
{
11
    public function testBlock(): void
12
    {
13
        echo Block::begin()
14
            ->id('testme')
15
            ->start();
16
17
        echo '<block-testme>';
18
19
        Block::end();
20
21
        $this->assertStringContainsString('<block-testme>', $this->webView->getBlock('testme'));
22
    }
23
24
    public function testBlockRenderInPlaceTrue(): void
25
    {
26
        ob_start();
27
        ob_implicit_flush(0);
28
29
        echo Block::begin()
30
            ->id('testme')
31
            ->renderInPlace(true)
32
            ->start();
33
34
        echo '<block-testme>';
35
36
        echo Block::end();
37
38
        $this->assertStringContainsString('<block-testme>', ob_get_clean());
39
    }
40
41
    public function testGetBlockException(): void
42
    {
43
        $this->expectException(\InvalidArgumentException::class);
44
        $this->webView->getBlock('notfound');
45
    }
46
}
47