Skip to content

Commit dbc559f

Browse files
committed
Test numeric values in xml attributes
1 parent 1457180 commit dbc559f

File tree

2 files changed

+18
-16
lines changed

2 files changed

+18
-16
lines changed

tests/AbstractXMLTestCase.php

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -31,22 +31,22 @@ protected function setUp(): void
3131

3232
$this->xmlData = new XMLData(new SimpleXMLElement(
3333
<<<'CODE_SAMPLE'
34-
<root>
35-
<title>test</title>
36-
<attribute test="value">test</attribute>
37-
<rates>
38-
<rate><name>Marco</name></rate>
39-
<rate><name>Polo</name></rate>
40-
</rates>
41-
<object>
42-
<type>x</type>
43-
<number>1</number>
44-
<child>
45-
<title>test</title>
46-
</child>
47-
</object>
48-
</root>
49-
CODE_SAMPLE
34+
<root>
35+
<title>test</title>
36+
<attribute test="value" numberZero="0" numberNonZero="1">test</attribute>
37+
<rates>
38+
<rate><name>Marco</name></rate>
39+
<rate><name>Polo</name></rate>
40+
</rates>
41+
<object>
42+
<type>x</type>
43+
<number>1</number>
44+
<child>
45+
<title>test</title>
46+
</child>
47+
</object>
48+
</root>
49+
CODE_SAMPLE
5050
));
5151

5252
$this->data = new GetValue($this->xmlData);

tests/GetValueXMLDataTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ public function testAttributes(): void
6060
$attributes = $this->data->getXMLAttributesGetter(self::KeyValueWithAttributes);
6161

6262
$this->assertEquals('value', $attributes->getRequiredString('test'));
63+
$this->assertEquals(0, $attributes->getRequiredInt('numberZero'));
64+
$this->assertEquals(1, $attributes->getRequiredInt('numberNonZero'));
6365
}
6466

6567
public function testAttributesOnEntryWithoutAttributes(): void

0 commit comments

Comments
 (0)