Passed
Push — master ( 00604e...06d537 )
by Darío
02:22
created

InputTest::testInputAttributesAndChildren()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 7
nc 1
nop 0
dl 0
loc 13
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * DronePHP (http://www.dronephp.com)
4
 *
5
 * @link      http://github.com/Pleets/DronePHP
6
 * @copyright Copyright (c) 2016-2018 Pleets. (http://www.pleets.org)
7
 * @license   http://www.dronephp.com/license
8
 * @author    Darío Rivera <[email protected]>
9
 */
10
11
namespace DroneTest\Dom\Element;
12
13
use Drone\Dom\Attribute;
14
use Drone\Dom\Element\Input;
15
use PHPUnit\Framework\TestCase;
16
17
class InputTest extends TestCase
18
{
19
    /**
20
     * Tests input tag constructor
21
     *
22
     * @return null
23
     */
24
    public function testInputTags()
25
    {
26
        $input = new Input();
27
28
        $this->assertEquals('<input', $input->getStartTag());
29
        $this->assertEquals('/>', $input->getEndTag());
30
    }
31
32
    /**
33
     * Tests adding attributes and children
34
     *
35
     * @return null
36
     */
37
    public function testInputAttributesAndChildren()
38
    {
39
        $input = new Input();
40
41
        $this->assertEquals(0, count($input->getAttributes()));
42
        $this->assertEquals(0, count($input->getChildren()));
43
44
        # adding an attribute
45
        $input->setAttribute(new Attribute("type", "hidden"));
46
47
        $attr = $input->getAttribute('type');
48
        $this->assertEquals("type", $attr->getName());
49
        $this->assertEquals("hidden", $attr->getValue());
50
    }
51
}