From 5034443e36043ca90c7ddcc5fb7656e7c3079b0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mika=C3=ABl=20DELSOL?= Date: Wed, 14 Jul 2021 01:04:24 +0200 Subject: [PATCH 1/2] issue #3 - disallow sequence tag as sub parent tag --- src/Tag/TagChoice.php | 1 + tests/Tag/TagChoiceTest.php | 15 +++++---------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/Tag/TagChoice.php b/src/Tag/TagChoice.php index ef8930b..d47a009 100644 --- a/src/Tag/TagChoice.php +++ b/src/Tag/TagChoice.php @@ -35,6 +35,7 @@ public static function getForbiddenParentTags(): array { return [ AbstractDocument::TAG_COMPLEX_TYPE, + AbstractDocument::TAG_SEQUENCE, ]; } diff --git a/tests/Tag/TagChoiceTest.php b/tests/Tag/TagChoiceTest.php index 2667c2d..56aed6f 100644 --- a/tests/Tag/TagChoiceTest.php +++ b/tests/Tag/TagChoiceTest.php @@ -28,6 +28,7 @@ public function testGetForbiddenParentTagsMustReturnTheListOfForbiddenParentTags { $this->assertSame([ 'complexType', + 'sequence', ], TagChoice::getForbiddenParentTags()); } @@ -187,11 +188,8 @@ public function testGetChildrenElementsMustReturnFirstLevelNestedChildrenTagsOfH $children = $choice->getChildrenElements(); - $this->assertCount(4, $children); - $this->assertSame('Success', $children[0]->getAttributeName()); - $this->assertSame('Warnings', $children[1]->getAttributeName()); - $this->assertSame('HotelDescriptiveContents', $children[2]->getAttributeName()); - $this->assertSame('Errors', $children[3]->getAttributeName()); + $this->assertCount(1, $children); + $this->assertSame('Errors', $children[0]->getAttributeName()); } /** @@ -263,11 +261,8 @@ public function testGetChildrenElementsMustReturnFirstLevelNestedChildrenTagsOfH $children = $choice->getChildrenElements(); - $this->assertCount(4, $children); - $this->assertSame('Success', $children[0]->getAttributeName()); - $this->assertSame('Warnings', $children[1]->getAttributeName()); - $this->assertSame('RoomStays', $children[2]->getAttributeName()); - $this->assertSame('Errors', $children[3]->getAttributeName()); + $this->assertCount(1, $children); + $this->assertSame('Errors', $children[0]->getAttributeName()); } /** From 221a62a40f49438363aea8be8ae32b4acbd8cdd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mika=C3=ABl=20DELSOL?= Date: Wed, 14 Jul 2021 01:07:00 +0200 Subject: [PATCH 2/2] update changelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e91f9f7..f1d00f5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # CHANGELOG +## 1.0.4 - 2021/07/14 +- issue #3 - Choice tag must ignore sequence tag + ## 1.0.3 - 2021/05/13 - issue #2 - getAttributeMessageNamespace() must be of the type string, null returned