Skip to content

Commit d9cc1a2

Browse files
committed
test for parent in any change
1 parent 032030c commit d9cc1a2

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

tests/ASN1/Universal/ChildrenTest.php

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,12 @@ public function testRemoveChild()
5050
$i++;
5151
}
5252

53-
$this->expectException(Exception::class);
53+
// Check all children have correct parent
54+
foreach ($object->getChildren() as $child) {
55+
self::assertEquals($child->getParent(), $object);
56+
}
5457

58+
$this->expectException(Exception::class);
5559
$object->removeChild($unknownChild);
5660
}
5761

@@ -117,6 +121,11 @@ public function testReplaceChild()
117121
$i++;
118122
}
119123

124+
// Check all children have correct parent
125+
foreach ($object->getChildren() as $child) {
126+
self::assertEquals($child->getParent(), $object);
127+
}
128+
120129
// Exception if we trying replace unknown child
121130
$this->expectException(Exception::class);
122131
$object->replaceChild($unknownChild, $replacement);
@@ -160,5 +169,10 @@ public function testAppendChild()
160169
self::assertEquals($i, $index);
161170
$i++;
162171
}
172+
173+
// Check all children have correct parent
174+
foreach ($object->getChildren() as $child) {
175+
self::assertEquals($child->getParent(), $object);
176+
}
163177
}
164178
}

0 commit comments

Comments
 (0)