Mercurial > hg > isophonics-drupal-site
comparison vendor/phar-io/manifest/tests/ManifestDocumentMapperTest.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 /** | |
6 * @covers \PharIo\Manifest\ManifestDocumentMapper | |
7 * | |
8 * @uses \PharIo\Manifest\ApplicationName | |
9 * @uses \PharIo\Manifest\Author | |
10 * @uses \PharIo\Manifest\AuthorCollection | |
11 * @uses \PharIo\Manifest\AuthorCollectionIterator | |
12 * @uses \PharIo\Manifest\AuthorElement | |
13 * @uses \PharIo\Manifest\AuthorElementCollection | |
14 * @uses \PharIo\Manifest\BundledComponent | |
15 * @uses \PharIo\Manifest\BundledComponentCollection | |
16 * @uses \PharIo\Manifest\BundledComponentCollectionIterator | |
17 * @uses \PharIo\Manifest\BundlesElement | |
18 * @uses \PharIo\Manifest\ComponentElement | |
19 * @uses \PharIo\Manifest\ComponentElementCollection | |
20 * @uses \PharIo\Manifest\ContainsElement | |
21 * @uses \PharIo\Manifest\CopyrightElement | |
22 * @uses \PharIo\Manifest\CopyrightInformation | |
23 * @uses \PharIo\Manifest\ElementCollection | |
24 * @uses \PharIo\Manifest\Email | |
25 * @uses \PharIo\Manifest\ExtElement | |
26 * @uses \PharIo\Manifest\ExtElementCollection | |
27 * @uses \PharIo\Manifest\License | |
28 * @uses \PharIo\Manifest\LicenseElement | |
29 * @uses \PharIo\Manifest\Manifest | |
30 * @uses \PharIo\Manifest\ManifestDocument | |
31 * @uses \PharIo\Manifest\ManifestDocumentMapper | |
32 * @uses \PharIo\Manifest\ManifestElement | |
33 * @uses \PharIo\Manifest\ManifestLoader | |
34 * @uses \PharIo\Manifest\PhpElement | |
35 * @uses \PharIo\Manifest\PhpExtensionRequirement | |
36 * @uses \PharIo\Manifest\PhpVersionRequirement | |
37 * @uses \PharIo\Manifest\RequirementCollection | |
38 * @uses \PharIo\Manifest\RequirementCollectionIterator | |
39 * @uses \PharIo\Manifest\RequiresElement | |
40 * @uses \PharIo\Manifest\Type | |
41 * @uses \PharIo\Manifest\Url | |
42 * @uses \PharIo\Version\Version | |
43 * @uses \PharIo\Version\VersionConstraint | |
44 */ | |
45 class ManifestDocumentMapperTest extends \PHPUnit_Framework_TestCase { | |
46 /** | |
47 * @dataProvider dataProvider | |
48 * | |
49 * @param $expected | |
50 * | |
51 * @uses \PharIo\Manifest\Application | |
52 * @uses \PharIo\Manifest\ApplicationName | |
53 * @uses \PharIo\Manifest\Library | |
54 * @uses \PharIo\Manifest\Extension | |
55 * @uses \PharIo\Manifest\ExtensionElement | |
56 */ | |
57 public function testCanSerializeToString($expected) { | |
58 $manifestDocument = ManifestDocument::fromFile($expected); | |
59 $mapper = new ManifestDocumentMapper(); | |
60 | |
61 $this->assertInstanceOf( | |
62 Manifest::class, | |
63 $mapper->map($manifestDocument) | |
64 ); | |
65 } | |
66 | |
67 public function dataProvider() { | |
68 return [ | |
69 'application' => [__DIR__ . '/_fixture/phpunit-5.6.5.xml'], | |
70 'library' => [__DIR__ . '/_fixture/library.xml'], | |
71 'extension' => [__DIR__ . '/_fixture/extension.xml'] | |
72 ]; | |
73 } | |
74 | |
75 public function testThrowsExceptionOnUnsupportedType() { | |
76 $manifestDocument = ManifestDocument::fromFile(__DIR__ . '/_fixture/custom.xml'); | |
77 $mapper = new ManifestDocumentMapper(); | |
78 | |
79 $this->expectException(ManifestDocumentMapperException::class); | |
80 $mapper->map($manifestDocument); | |
81 } | |
82 | |
83 public function testInvalidVersionInformationThrowsException() { | |
84 $manifestDocument = ManifestDocument::fromFile(__DIR__ . '/_fixture/invalidversion.xml'); | |
85 $mapper = new ManifestDocumentMapper(); | |
86 | |
87 $this->expectException(ManifestDocumentMapperException::class); | |
88 $mapper->map($manifestDocument); | |
89 } | |
90 | |
91 public function testInvalidVersionConstraintThrowsException() { | |
92 $manifestDocument = ManifestDocument::fromFile(__DIR__ . '/_fixture/invalidversionconstraint.xml'); | |
93 $mapper = new ManifestDocumentMapper(); | |
94 | |
95 $this->expectException(ManifestDocumentMapperException::class); | |
96 $mapper->map($manifestDocument); | |
97 } | |
98 | |
99 /** | |
100 * @uses \PharIo\Manifest\ExtensionElement | |
101 */ | |
102 public function testInvalidCompatibleConstraintThrowsException() { | |
103 $manifestDocument = ManifestDocument::fromFile(__DIR__ . '/_fixture/extension-invalidcompatible.xml'); | |
104 $mapper = new ManifestDocumentMapper(); | |
105 | |
106 $this->expectException(ManifestDocumentMapperException::class); | |
107 $mapper->map($manifestDocument); | |
108 } | |
109 | |
110 } |