Mercurial > hg > cmmr2012-drupal-site
annotate vendor/phar-io/manifest/tests/xml/RequiresElementTest.php @ 2:5311817fb629
Theme updates
author | Chris Cannam |
---|---|
date | Tue, 10 Jul 2018 13:19:18 +0000 |
parents | |
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 } |