public function addTestSuite($name, $directory) { if (!$this->testsuites) { $this->testsuites = $this->xml->add('testsuites', true); } $this->testsuites->add('testsuite', true)->attr('name', $name)->add('directory', $directory); return $this; }
$dom = $xml->dom(); $domxp = new \DOMXPath($dom); $nodes = $domxp->query('/doc/*'); $doc = new FluidDocument(); $handler = new FluidInsertionHandler($doc); $new_cx = new FluidContext($doc, $handler, $nodes); $actual = $new_cx->asArray(); $expected = $cx->asArray(); \assert($actual === $expected, __($actual, $expected)); }); it('should accept a FluidContext', function () { $xml = new FluidXml(); $cx = $xml->appendChild(['head', 'body'], true); $doc = new FluidDocument(); $handler = new FluidInsertionHandler($doc); $new_cx = new FluidContext($doc, $handler, $cx); $actual = $new_cx->asArray(); $expected = $cx->asArray(); \assert($actual === $expected, __($actual, $expected)); }); it('should throw for not supported document', function () { $doc = new FluidDocument(); $handler = new FluidInsertionHandler($doc); try { new FluidContext($doc, $handler, 'node'); } catch (\Exception $e) { $actual = $e; } assert_is_a($actual, \Exception::class); }); });