comparison vendor/phar-io/manifest/tests/xml/BundlesElementTest.php @ 14:1fec387a4317

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