annotate vendor/phar-io/manifest/tests/xml/BundlesElementTest.php @ 19:fa3358dc1485 tip

Add ndrum files
author Chris Cannam
date Wed, 28 Aug 2019 13:14:47 +0100
parents 1fec387a4317
children
rev   line source
Chris@14 1 <?php
Chris@14 2
Chris@14 3 namespace PharIo\Manifest;
Chris@14 4
Chris@14 5 use DOMDocument;
Chris@14 6
Chris@14 7 class BundlesElementTest extends \PHPUnit_Framework_TestCase {
Chris@14 8 /**
Chris@14 9 * @var DOMDocument
Chris@14 10 */
Chris@14 11 private $dom;
Chris@14 12
Chris@14 13 /**
Chris@14 14 * @var BundlesElement
Chris@14 15 */
Chris@14 16 private $bundles;
Chris@14 17
Chris@14 18 protected function setUp() {
Chris@14 19 $this->dom = new DOMDocument();
Chris@14 20 $this->dom->loadXML('<?xml version="1.0" ?><bundles xmlns="https://phar.io/xml/manifest/1.0" />');
Chris@14 21 $this->bundles = new BundlesElement($this->dom->documentElement);
Chris@14 22 }
Chris@14 23
Chris@14 24 public function testThrowsExceptionWhenGetComponentElementsIsCalledButNodesAreMissing() {
Chris@14 25 $this->expectException(ManifestElementException::class);
Chris@14 26 $this->bundles->getComponentElements();
Chris@14 27 }
Chris@14 28
Chris@14 29 public function testGetComponentElementsReturnsComponentElementCollection() {
Chris@14 30 $this->addComponent();
Chris@14 31 $this->assertInstanceOf(
Chris@14 32 ComponentElementCollection::class, $this->bundles->getComponentElements()
Chris@14 33 );
Chris@14 34 }
Chris@14 35
Chris@14 36 private function addComponent() {
Chris@14 37 $this->dom->documentElement->appendChild(
Chris@14 38 $this->dom->createElementNS('https://phar.io/xml/manifest/1.0', 'component')
Chris@14 39 );
Chris@14 40 }
Chris@14 41 }