annotate vendor/phar-io/manifest/tests/xml/RequiresElementTest.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 RequiresElementTest 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 RequiresElement
Chris@2 15 */
Chris@2 16 private $requires;
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" ?><requires xmlns="https://phar.io/xml/manifest/1.0" />');
Chris@2 21 $this->requires = new RequiresElement($this->dom->documentElement);
Chris@2 22 }
Chris@2 23
Chris@2 24 public function testThrowsExceptionWhenGetPhpElementIsCalledButElementIsMissing() {
Chris@2 25 $this->expectException(ManifestElementException::class);
Chris@2 26 $this->requires->getPHPElement();
Chris@2 27 }
Chris@2 28
Chris@2 29 public function testHasExtElementsReturnsTrueWhenExtensionsAreRequired() {
Chris@2 30 $this->dom->documentElement->appendChild(
Chris@2 31 $this->dom->createElementNS('https://phar.io/xml/manifest/1.0', 'php')
Chris@2 32 );
Chris@2 33
Chris@2 34 $this->assertInstanceOf(PhpElement::class, $this->requires->getPHPElement());
Chris@2 35 }
Chris@2 36
Chris@2 37 }