LabelFieldUnitTest::testConstructor()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 7
nc 1
nop 0
dl 0
loc 15
rs 10
c 0
b 0
f 0
1
<?php
2
namespace Mezon\Gui\Field\Tests;
3
4
use PHPUnit\Framework\TestCase;
5
use Mezon\Gui\Field\LabelField;
6
7
/**
8
 *
9
 * @psalm-suppress PropertyNotSetInConstructor
10
 */
11
class LabelFieldUnitTest extends TestCase
12
{
13
14
    /**
15
     * Testing constructor
16
     */
17
    public function testConstructor(): void
18
    {
19
        // setup
20
        $field = new LabelField([
21
            'text' => 'name'
22
        ]);
23
24
        // test body
25
        $content = $field->html();
26
27
        // assertions
28
        $this->assertStringContainsString(
29
            '<label class="control-label">name</label>',
30
            $content,
31
            'Label was not generated');
32
    }
33
34
    /**
35
     * Testing getType method
36
     */
37
    public function testGetType(): void
38
    {
39
        // setup
40
        $field = new LabelField([
41
            'text' => 'name'
42
        ]);
43
44
        // test body and assertions
45
        $this->assertStringContainsString('label', $field->getType());
46
    }
47
48
    /**
49
     * Testing fillAllRow method
50
     */
51
    public function testFillAllRow(): void
52
    {
53
        // setup
54
        $field = new LabelField([
55
            'text' => 'name'
56
        ]);
57
58
        // test body and assertions
59
        $this->assertTrue($field->fillAllRow());
60
    }
61
}
62