Skip to content

Commit 5034443

Browse files
committed
issue #3 - disallow sequence tag as sub parent tag
1 parent 2c211fc commit 5034443

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

src/Tag/TagChoice.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public static function getForbiddenParentTags(): array
3535
{
3636
return [
3737
AbstractDocument::TAG_COMPLEX_TYPE,
38+
AbstractDocument::TAG_SEQUENCE,
3839
];
3940
}
4041

tests/Tag/TagChoiceTest.php

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ public function testGetForbiddenParentTagsMustReturnTheListOfForbiddenParentTags
2828
{
2929
$this->assertSame([
3030
'complexType',
31+
'sequence',
3132
], TagChoice::getForbiddenParentTags());
3233
}
3334

@@ -187,11 +188,8 @@ public function testGetChildrenElementsMustReturnFirstLevelNestedChildrenTagsOfH
187188

188189
$children = $choice->getChildrenElements();
189190

190-
$this->assertCount(4, $children);
191-
$this->assertSame('Success', $children[0]->getAttributeName());
192-
$this->assertSame('Warnings', $children[1]->getAttributeName());
193-
$this->assertSame('HotelDescriptiveContents', $children[2]->getAttributeName());
194-
$this->assertSame('Errors', $children[3]->getAttributeName());
191+
$this->assertCount(1, $children);
192+
$this->assertSame('Errors', $children[0]->getAttributeName());
195193
}
196194

197195
/**
@@ -263,11 +261,8 @@ public function testGetChildrenElementsMustReturnFirstLevelNestedChildrenTagsOfH
263261

264262
$children = $choice->getChildrenElements();
265263

266-
$this->assertCount(4, $children);
267-
$this->assertSame('Success', $children[0]->getAttributeName());
268-
$this->assertSame('Warnings', $children[1]->getAttributeName());
269-
$this->assertSame('RoomStays', $children[2]->getAttributeName());
270-
$this->assertSame('Errors', $children[3]->getAttributeName());
264+
$this->assertCount(1, $children);
265+
$this->assertSame('Errors', $children[0]->getAttributeName());
271266
}
272267

273268
/**

0 commit comments

Comments
 (0)