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