comparison vendor/phar-io/manifest/tests/xml/RequiresElementTest.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 RequiresElementTest extends \PHPUnit_Framework_TestCase {
8 /**
9 * @var DOMDocument
10 */
11 private $dom;
12
13 /**
14 * @var RequiresElement
15 */
16 private $requires;
17
18 protected function setUp() {
19 $this->dom = new DOMDocument();
20 $this->dom->loadXML('<?xml version="1.0" ?><requires xmlns="https://phar.io/xml/manifest/1.0" />');
21 $this->requires = new RequiresElement($this->dom->documentElement);
22 }
23
24 public function testThrowsExceptionWhenGetPhpElementIsCalledButElementIsMissing() {
25 $this->expectException(ManifestElementException::class);
26 $this->requires->getPHPElement();
27 }
28
29 public function testHasExtElementsReturnsTrueWhenExtensionsAreRequired() {
30 $this->dom->documentElement->appendChild(
31 $this->dom->createElementNS('https://phar.io/xml/manifest/1.0', 'php')
32 );
33
34 $this->assertInstanceOf(PhpElement::class, $this->requires->getPHPElement());
35 }
36
37 }