Mercurial > hg > cmmr2012-drupal-site
comparison vendor/phar-io/manifest/tests/xml/PhpElementTest.php @ 2:5311817fb629
Theme updates
author | Chris Cannam |
---|---|
date | Tue, 10 Jul 2018 13:19:18 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
1:0b0e5f3b1e83 | 2:5311817fb629 |
---|---|
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 } |