comparison vendor/phar-io/manifest/tests/xml/PhpElementTest.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 PhpElementTest extends \PHPUnit_Framework_TestCase {
8 /**
9 * @var DOMDocument
10 */
11 private $dom;
12
13 /**
14 * @var PhpElement
15 */
16 private $php;
17
18 protected function setUp() {
19 $this->dom = new DOMDocument();
20 $this->dom->loadXML('<?xml version="1.0" ?><php xmlns="https://phar.io/xml/manifest/1.0" version="^5.6 || ^7.0" />');
21 $this->php = new PhpElement($this->dom->documentElement);
22 }
23
24 public function testVersionConstraintCanBeRetrieved() {
25 $this->assertEquals('^5.6 || ^7.0', $this->php->getVersion());
26 }
27
28 public function testHasExtElementsReturnsFalseWhenNoExtensionsAreRequired() {
29 $this->assertFalse($this->php->hasExtElements());
30 }
31
32 public function testHasExtElementsReturnsTrueWhenExtensionsAreRequired() {
33 $this->addExtElement();
34 $this->assertTrue($this->php->hasExtElements());
35 }
36
37 public function testGetExtElementsReturnsExtElementCollection() {
38 $this->addExtElement();
39 $this->assertInstanceOf(ExtElementCollection::class, $this->php->getExtElements());
40 }
41
42 private function addExtElement() {
43 $this->dom->documentElement->appendChild(
44 $this->dom->createElementNS('https://phar.io/xml/manifest/1.0', 'ext')
45 );
46 }
47
48 }