| @@ 121-130 (lines=10) @@ | ||
| 118 | /** |
|
| 119 | * Проверка получения текста |
|
| 120 | */ |
|
| 121 | public function testGetText() |
|
| 122 | { |
|
| 123 | /** @var \DOMElement $elem */ |
|
| 124 | $elem = static::$xpath->query('//testGetText')->item(0); |
|
| 125 | $text = XmlUtil::getText($elem); |
|
| 126 | ||
| 127 | $expected = 'test_text_1test_text_2'; |
|
| 128 | ||
| 129 | static::assertEquals($expected, $text); |
|
| 130 | } |
|
| 131 | ||
| 132 | ||
| 133 | /** |
|
| @@ 136-145 (lines=10) @@ | ||
| 133 | /** |
|
| 134 | * Проверка получения текста |
|
| 135 | */ |
|
| 136 | public function testGetChildText() |
|
| 137 | { |
|
| 138 | /** @var \DOMElement $elem */ |
|
| 139 | $elem = static::$xpath->query('//testGetChildText')->item(0); |
|
| 140 | $text = XmlUtil::getChildText($elem, 'element1'); |
|
| 141 | ||
| 142 | $expected = 'test_text_1test_text_2'; |
|
| 143 | ||
| 144 | static::assertEquals($expected, $text); |
|
| 145 | } |
|
| 146 | ||
| 147 | /** |
|
| 148 | * Проверка получения текста |
|
| @@ 150-157 (lines=8) @@ | ||
| 147 | /** |
|
| 148 | * Проверка получения текста |
|
| 149 | */ |
|
| 150 | public function testGetChildTextNotFoundElement() |
|
| 151 | { |
|
| 152 | /** @var \DOMElement $elem */ |
|
| 153 | $elem = static::$xpath->query('//testGetChildText')->item(0); |
|
| 154 | $text = XmlUtil::getChildText($elem, 'element3'); |
|
| 155 | ||
| 156 | static::assertEquals(null, $text); |
|
| 157 | } |
|
| 158 | ||
| 159 | ||
| 160 | /** |
|
| @@ 163-170 (lines=8) @@ | ||
| 160 | /** |
|
| 161 | * Проверка получения значения атрибута |
|
| 162 | */ |
|
| 163 | public function testGetRequiredAttributeValue() |
|
| 164 | { |
|
| 165 | /** @var \DOMElement $elem */ |
|
| 166 | $elem = static::$xpath->query('//testGetRequiredAttributeValue/element1')->item(0); |
|
| 167 | $text = XmlUtil::getRequiredAttributeValue($elem, 'level'); |
|
| 168 | ||
| 169 | static::assertEquals('1', $text); |
|
| 170 | } |
|
| 171 | ||
| 172 | ||
| 173 | /** |
|