Mercurial > hg > isophonics-drupal-site
comparison vendor/phar-io/manifest/tests/xml/CopyrightElementTest.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 CopyrightElementTest extends \PHPUnit_Framework_TestCase { | |
8 /** | |
9 * @var DOMDocument | |
10 */ | |
11 private $dom; | |
12 | |
13 /** | |
14 * @var CopyrightElement | |
15 */ | |
16 private $copyright; | |
17 | |
18 protected function setUp() { | |
19 $this->dom = new DOMDocument(); | |
20 $this->dom->loadXML('<?xml version="1.0" ?><copyright xmlns="https://phar.io/xml/manifest/1.0" />'); | |
21 $this->copyright = new CopyrightElement($this->dom->documentElement); | |
22 } | |
23 | |
24 public function testThrowsExceptionWhenGetAuthroElementsIsCalledButNodesAreMissing() { | |
25 $this->expectException(ManifestElementException::class); | |
26 $this->copyright->getAuthorElements(); | |
27 } | |
28 | |
29 public function testThrowsExceptionWhenGetLicenseElementIsCalledButNodeIsMissing() { | |
30 $this->expectException(ManifestElementException::class); | |
31 $this->copyright->getLicenseElement(); | |
32 } | |
33 | |
34 public function testGetAuthorElementsReturnsAuthorElementCollection() { | |
35 $this->dom->documentElement->appendChild( | |
36 $this->dom->createElementNS('https://phar.io/xml/manifest/1.0', 'author') | |
37 ); | |
38 $this->assertInstanceOf( | |
39 AuthorElementCollection::class, $this->copyright->getAuthorElements() | |
40 ); | |
41 } | |
42 | |
43 public function testGetLicenseElementReturnsLicenseElement() { | |
44 $this->dom->documentElement->appendChild( | |
45 $this->dom->createElementNS('https://phar.io/xml/manifest/1.0', 'license') | |
46 ); | |
47 $this->assertInstanceOf( | |
48 LicenseElement::class, $this->copyright->getLicenseElement() | |
49 ); | |
50 } | |
51 | |
52 } |