$actual = $r[0]->nodeName;
$expected = 'g';
\assert($actual === $expected, __($actual, $expected));
});
});
describe('.each', function () {
it('should be fluid', function () {
assert_is_fluid('each', function () {
});
});
it('should iterate the nodes inside the context', function () {
$xml = new FluidXml();
$xml->each(function ($i, $n) {
assert_is_a($this, FluidContext::class);
assert_is_a($n, \DOMNode::class);
$actual = $i;
$expected = 0;
\assert($actual === $expected, __($actual, $expected));
});
function eachassert($cx, $i, $n)
{
assert_is_a($cx, FluidContext::class);
assert_is_a($n, \DOMNode::class);
$actual = $i;
$expected = 0;
\assert($actual === $expected, __($actual, $expected));
}
$xml->each('eachassert');
$xml->appendChild('child1')->appendChild('child2');
$nodes = [];
$index = 0;