annotate vendor/phar-io/manifest/tests/xml/BundlesElementTest.php @ 5:12f9dff5fda9 tip

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