$cx = $cx->addChild(['subchild1', 'subchild2', 'subchild3']); $actual = $cx->length(); $expected = 2; \assert($actual === $expected, __($actual, $expected)); $cx = $cx->addChild(['subchild4', 'subchild5', 'subchild6', 'subchild7'], true); $actual = $cx->length(); $expected = 8; \assert($actual === $expected, __($actual, $expected)); $expected = "<doc>\n" . " <child1>\n" . " <subchild1/>\n" . " <subchild2/>\n" . " <subchild3/>\n" . " <subchild4/>\n" . " <subchild5/>\n" . " <subchild6/>\n" . " <subchild7/>\n" . " </child1>\n" . " <child2>\n" . " <subchild1/>\n" . " <subchild2/>\n" . " <subchild3/>\n" . " <subchild4/>\n" . " <subchild5/>\n" . " <subchild6/>\n" . " <subchild7/>\n" . " </child2>\n" . "</doc>"; assert_equal_xml($xml, $expected); }); }); describe('.size()', function () { it('should behave like .length()', function () { $xml = new FluidXml(); $actual = $xml->size(); $expected = $xml->length(); \assert($actual === $expected, __($actual, $expected)); $cx = $xml->addChild('parent', true)->addChild(['child1', 'child2']); $actual = $cx->size(); $expected = $cx->length(); \assert($actual === $expected, __($actual, $expected)); }); }); }); describe('FluidNamespace', function () { describe('.__construct()', function () { it('should accept an id, an uri and an optional mode flag', function () { $ns_id = 'x'; $ns_uri = 'x.com'; $ns_mode = FluidNamespace::MODE_EXPLICIT;