Skip to content

Commit

Permalink
Test numeric values in xml attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
pionl committed Oct 18, 2023
1 parent 1457180 commit dbc559f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 16 deletions.
32 changes: 16 additions & 16 deletions tests/AbstractXMLTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,22 @@ protected function setUp(): void

$this->xmlData = new XMLData(new SimpleXMLElement(
<<<'CODE_SAMPLE'
<root>
<title>test</title>
<attribute test="value">test</attribute>
<rates>
<rate><name>Marco</name></rate>
<rate><name>Polo</name></rate>
</rates>
<object>
<type>x</type>
<number>1</number>
<child>
<title>test</title>
</child>
</object>
</root>
CODE_SAMPLE
<root>
<title>test</title>
<attribute test="value" numberZero="0" numberNonZero="1">test</attribute>
<rates>
<rate><name>Marco</name></rate>
<rate><name>Polo</name></rate>
</rates>
<object>
<type>x</type>
<number>1</number>
<child>
<title>test</title>
</child>
</object>
</root>
CODE_SAMPLE
));

$this->data = new GetValue($this->xmlData);
Expand Down
2 changes: 2 additions & 0 deletions tests/GetValueXMLDataTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ public function testAttributes(): void
$attributes = $this->data->getXMLAttributesGetter(self::KeyValueWithAttributes);

$this->assertEquals('value', $attributes->getRequiredString('test'));
$this->assertEquals(0, $attributes->getRequiredInt('numberZero'));
$this->assertEquals(1, $attributes->getRequiredInt('numberNonZero'));
}

public function testAttributesOnEntryWithoutAttributes(): void
Expand Down

0 comments on commit dbc559f

Please sign in to comment.