Passed
Push — master ( fdae84...25d981 )
by Aleksei
08:01
created

FormatTest   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 64
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 64
rs 10
c 0
b 0
f 0
eloc 36
wmc 5
1
<?php
2
3
/**
4
 * Spiral Framework.
5
 *
6
 * @license   MIT
7
 * @author    Anton Titov (Wolfy-J)
8
 */
9
10
declare(strict_types=1);
11
12
namespace Spiral\Tests\Stempler;
13
14
use Spiral\Views\ViewContext;
15
16
class FormatTest extends BaseTest
17
{
18
    public function testFormatDiv(): void
19
    {
20
        $s = $this->getStempler();
21
22
        $this->assertSame(
23
            "<div>\n  hello\n</div>",
24
            $s->get('format/f1', new ViewContext())->render([])
25
        );
26
    }
27
28
    public function testFormatDiv2(): void
29
    {
30
        $s = $this->getStempler();
31
32
        $this->assertSame(
33
            "<div>\n  hello\n</div>",
34
            $s->get('format/f2', new ViewContext())->render([])
35
        );
36
    }
37
38
    public function testFormatDiv3(): void
39
    {
40
        $s = $this->getStempler();
41
42
        $this->assertSame(
43
            '<div> first
44
  <div>
45
    hello
46
  </div>
47
  test
48
</div>',
49
            $s->get('format/f3', new ViewContext())->render([])
50
        );
51
    }
52
53
    public function testFormatDiv4(): void
54
    {
55
        $s = $this->getStempler();
56
57
        $this->assertSame(
58
            '<div>
59
  hello
60
  <pre>
61
          test magic
62
63
64
    </pre>
65
  extra spaces
66
</div>',
67
            str_replace("\r", '', $s->get('format/f4', new ViewContext())->render([]))
68
        );
69
    }
70
71
    public function testFormatDiv5(): void
72
    {
73
        $s = $this->getStempler();
74
75
        $this->assertSame(
76
            '<div>
77
  hello
78
</div>',
79
            $s->get('format/f5', new ViewContext())->render([])
80
        );
81
    }
82
}
83