Added Laravel project
This commit is contained in:
8
Laravel/vendor/phar-io/manifest/.gitignore
vendored
Normal file
8
Laravel/vendor/phar-io/manifest/.gitignore
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
/.idea
|
||||
/.php_cs.cache
|
||||
/composer.lock
|
||||
/src/autoload.php
|
||||
/tools
|
||||
/vendor
|
||||
|
||||
/build
|
67
Laravel/vendor/phar-io/manifest/.php_cs
vendored
Normal file
67
Laravel/vendor/phar-io/manifest/.php_cs
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
$finder = Symfony\CS\Finder\DefaultFinder::create()
|
||||
->files()
|
||||
->in('src')
|
||||
->in('tests')
|
||||
->name('*.php');
|
||||
|
||||
return Symfony\CS\Config\Config::create()
|
||||
->setUsingCache(true)
|
||||
->level(\Symfony\CS\FixerInterface::NONE_LEVEL)
|
||||
->fixers(
|
||||
array(
|
||||
'align_double_arrow',
|
||||
'align_equals',
|
||||
'concat_with_spaces',
|
||||
'duplicate_semicolon',
|
||||
'elseif',
|
||||
'empty_return',
|
||||
'encoding',
|
||||
'eof_ending',
|
||||
'extra_empty_lines',
|
||||
'function_call_space',
|
||||
'function_declaration',
|
||||
'indentation',
|
||||
'join_function',
|
||||
'line_after_namespace',
|
||||
'linefeed',
|
||||
'list_commas',
|
||||
'lowercase_constants',
|
||||
'lowercase_keywords',
|
||||
'method_argument_space',
|
||||
'multiple_use',
|
||||
'namespace_no_leading_whitespace',
|
||||
'no_blank_lines_after_class_opening',
|
||||
'no_empty_lines_after_phpdocs',
|
||||
'parenthesis',
|
||||
'php_closing_tag',
|
||||
'phpdoc_indent',
|
||||
'phpdoc_no_access',
|
||||
'phpdoc_no_empty_return',
|
||||
'phpdoc_no_package',
|
||||
'phpdoc_params',
|
||||
'phpdoc_scalar',
|
||||
'phpdoc_separation',
|
||||
'phpdoc_to_comment',
|
||||
'phpdoc_trim',
|
||||
'phpdoc_types',
|
||||
'phpdoc_var_without_name',
|
||||
'remove_lines_between_uses',
|
||||
'return',
|
||||
'self_accessor',
|
||||
'short_array_syntax',
|
||||
'short_tag',
|
||||
'single_line_after_imports',
|
||||
'single_quote',
|
||||
'spaces_before_semicolon',
|
||||
'spaces_cast',
|
||||
'ternary_spaces',
|
||||
'trailing_spaces',
|
||||
'trim_array_spaces',
|
||||
'unused_use',
|
||||
'visibility',
|
||||
'whitespacy_lines'
|
||||
)
|
||||
)
|
||||
->finder($finder);
|
||||
|
33
Laravel/vendor/phar-io/manifest/.travis.yml
vendored
Normal file
33
Laravel/vendor/phar-io/manifest/.travis.yml
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
os:
|
||||
- linux
|
||||
|
||||
language: php
|
||||
|
||||
before_install:
|
||||
- wget https://phar.io/releases/phive.phar
|
||||
- wget https://phar.io/releases/phive.phar.asc
|
||||
- gpg --keyserver hkps.pool.sks-keyservers.net --recv-keys 0x9B2D5D79
|
||||
- gpg --verify phive.phar.asc phive.phar
|
||||
- chmod +x phive.phar
|
||||
- sudo mv phive.phar /usr/bin/phive
|
||||
|
||||
install:
|
||||
- ant setup
|
||||
|
||||
script: ./tools/phpunit
|
||||
|
||||
php:
|
||||
- 5.6
|
||||
- 7.0
|
||||
- 7.1
|
||||
- 7.0snapshot
|
||||
- 7.1snapshot
|
||||
- master
|
||||
|
||||
matrix:
|
||||
allow_failures:
|
||||
- php: master
|
||||
fast_finish: true
|
||||
|
||||
notifications:
|
||||
email: false
|
31
Laravel/vendor/phar-io/manifest/LICENSE
vendored
Normal file
31
Laravel/vendor/phar-io/manifest/LICENSE
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
manifest
|
||||
|
||||
Copyright (c) 2016 Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>, and contributors
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the name of Arne Blankerts nor the names of contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT * NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
|
||||
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
30
Laravel/vendor/phar-io/manifest/README.md
vendored
Normal file
30
Laravel/vendor/phar-io/manifest/README.md
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
# Manifest
|
||||
|
||||
Component for reading [phar.io](https://phar.io/) manifest information from a [PHP Archive (PHAR)](http://php.net/phar).
|
||||
|
||||
[](https://travis-ci.org/phar-io/manifest)
|
||||
[](https://scrutinizer-ci.com/g/phar-io/manifest/?branch=master)
|
||||
[](https://insight.sensiolabs.com/projects/d8cc6035-69ad-477d-bd1a-ccc605480fd7)
|
||||
|
||||
## Installation
|
||||
|
||||
You can add this library as a local, per-project dependency to your project using [Composer](https://getcomposer.org/):
|
||||
|
||||
composer require phar-io/manifest
|
||||
|
||||
If you only need this library during development, for instance to run your project's test suite, then you should add it as a development-time dependency:
|
||||
|
||||
composer require --dev phar-io/manifest
|
||||
|
||||
## Usage
|
||||
|
||||
```php
|
||||
use PharIo\Manifest\ManifestLoader;
|
||||
use PharIo\Manifest\ManifestSerializer;
|
||||
|
||||
$manifest = ManifestLoader::fromFile('manifest.xml');
|
||||
|
||||
var_dump($manifest);
|
||||
|
||||
echo (new ManifestSerializer)->serializeToString($manifest);
|
||||
```
|
50
Laravel/vendor/phar-io/manifest/build.xml
vendored
Normal file
50
Laravel/vendor/phar-io/manifest/build.xml
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project name="manifest" default="setup">
|
||||
<target name="setup" depends="clean,install-tools,install-dependencies"/>
|
||||
|
||||
<target name="clean" unless="clean.done" description="Cleanup build artifacts">
|
||||
<delete dir="${basedir}/tools"/>
|
||||
<delete dir="${basedir}/vendor"/>
|
||||
<delete file="${basedir}/src/autoload.php"/>
|
||||
|
||||
<property name="clean.done" value="true"/>
|
||||
</target>
|
||||
|
||||
<target name="prepare" unless="prepare.done" depends="clean" description="Prepare for build">
|
||||
<property name="prepare.done" value="true"/>
|
||||
</target>
|
||||
|
||||
<target name="install-dependencies" unless="dependencies-installed" depends="-dependencies-installed" description="Install dependencies with Composer">
|
||||
<exec executable="composer" taskname="composer">
|
||||
<env key="COMPOSER_DISABLE_XDEBUG_WARN" value="1"/>
|
||||
<arg value="update"/>
|
||||
<arg value="--no-interaction"/>
|
||||
<arg value="--no-progress"/>
|
||||
<arg value="--no-ansi"/>
|
||||
<arg value="--no-suggest"/>
|
||||
<arg value="--optimize-autoloader"/>
|
||||
<arg value="--prefer-stable"/>
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<target name="install-tools" unless="tools-installed" depends="-tools-installed" description="Install tools with Phive">
|
||||
<exec executable="phive" taskname="phive">
|
||||
<arg value="install"/>
|
||||
<arg value="--trust-gpg-keys" />
|
||||
<arg value="4AA394086372C20A,2A8299CE842DD38C" />
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<target name="test" depends="install-tools,install-dependencies" description="Run tests">
|
||||
<exec executable="${basedir}/tools/phpunit" taskname="phpunit"/>
|
||||
</target>
|
||||
|
||||
<target name="-dependencies-installed">
|
||||
<available file="${basedir}/composer.lock" property="dependencies-installed"/>
|
||||
</target>
|
||||
|
||||
<target name="-tools-installed">
|
||||
<available file="${basedir}/tools" property="tools-installed" type="dir"/>
|
||||
</target>
|
||||
</project>
|
||||
|
42
Laravel/vendor/phar-io/manifest/composer.json
vendored
Normal file
42
Laravel/vendor/phar-io/manifest/composer.json
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
{
|
||||
"name": "phar-io/manifest",
|
||||
"description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)",
|
||||
"license": "BSD-3-Clause",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Arne Blankerts",
|
||||
"email": "arne@blankerts.de",
|
||||
"role": "Developer"
|
||||
},
|
||||
{
|
||||
"name": "Sebastian Heuer",
|
||||
"email": "sebastian@phpeople.de",
|
||||
"role": "Developer"
|
||||
},
|
||||
{
|
||||
"name": "Sebastian Bergmann",
|
||||
"email": "sebastian@phpunit.de",
|
||||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/phar-io/manifest/issues"
|
||||
},
|
||||
"require": {
|
||||
"php": "^5.6 || ^7.0",
|
||||
"ext-dom": "*",
|
||||
"ext-phar": "*",
|
||||
"phar-io/version": "^1.0.1"
|
||||
},
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
"src/"
|
||||
]
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.0.x-dev"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
23
Laravel/vendor/phar-io/manifest/examples/example-01.php
vendored
Normal file
23
Laravel/vendor/phar-io/manifest/examples/example-01.php
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of PharIo\Manifest.
|
||||
*
|
||||
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use PharIo\Manifest\ManifestLoader;
|
||||
use PharIo\Manifest\ManifestSerializer;
|
||||
|
||||
require __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
$manifest = ManifestLoader::fromFile(__DIR__ . '/../tests/_fixture/phpunit-5.6.5.xml');
|
||||
|
||||
echo sprintf(
|
||||
"Manifest for %s (%s):\n\n",
|
||||
$manifest->getName(),
|
||||
$manifest->getVersion()->getVersionString()
|
||||
);
|
||||
echo (new ManifestSerializer)->serializeToString($manifest);
|
4
Laravel/vendor/phar-io/manifest/phive.xml
vendored
Normal file
4
Laravel/vendor/phar-io/manifest/phive.xml
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<phive xmlns="https://phar.io/phive">
|
||||
<phar name="phpunit" version="^5.7" installed="5.7.15" location="./tools/phpunit"/>
|
||||
</phive>
|
20
Laravel/vendor/phar-io/manifest/phpunit.xml
vendored
Normal file
20
Laravel/vendor/phar-io/manifest/phpunit.xml
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/5.6/phpunit.xsd"
|
||||
bootstrap="vendor/autoload.php"
|
||||
backupGlobals="false"
|
||||
beStrictAboutCoversAnnotation="true"
|
||||
beStrictAboutOutputDuringTests="true"
|
||||
beStrictAboutTestsThatDoNotTestAnything="true"
|
||||
beStrictAboutTodoAnnotatedTests="true"
|
||||
verbose="true">
|
||||
<testsuite>
|
||||
<directory suffix="Test.php">tests</directory>
|
||||
</testsuite>
|
||||
|
||||
<filter>
|
||||
<whitelist processUncoveredFilesFromWhitelist="true">
|
||||
<directory suffix=".php">src</directory>
|
||||
</whitelist>
|
||||
</filter>
|
||||
</phpunit>
|
193
Laravel/vendor/phar-io/manifest/src/ManifestDocumentMapper.php
vendored
Normal file
193
Laravel/vendor/phar-io/manifest/src/ManifestDocumentMapper.php
vendored
Normal file
@@ -0,0 +1,193 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of PharIo\Manifest.
|
||||
*
|
||||
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace PharIo\Manifest;
|
||||
|
||||
use PharIo\Version\Version;
|
||||
use PharIo\Version\Exception as VersionException;
|
||||
use PharIo\Version\VersionConstraintParser;
|
||||
|
||||
class ManifestDocumentMapper {
|
||||
/**
|
||||
* @param ManifestDocument $document
|
||||
*
|
||||
* @returns Manifest
|
||||
*
|
||||
* @throws ManifestDocumentMapperException
|
||||
*/
|
||||
public function map(ManifestDocument $document) {
|
||||
try {
|
||||
$contains = $document->getContainsElement();
|
||||
$type = $this->mapType($contains);
|
||||
$copyright = $this->mapCopyright($document->getCopyrightElement());
|
||||
$requirements = $this->mapRequirements($document->getRequiresElement());
|
||||
$bundledComponents = $this->mapBundledComponents($document);
|
||||
|
||||
return new Manifest(
|
||||
new ApplicationName($contains->getName()),
|
||||
new Version($contains->getVersion()),
|
||||
$type,
|
||||
$copyright,
|
||||
$requirements,
|
||||
$bundledComponents
|
||||
);
|
||||
} catch (VersionException $e) {
|
||||
throw new ManifestDocumentMapperException($e->getMessage(), $e->getCode(), $e);
|
||||
} catch (Exception $e) {
|
||||
throw new ManifestDocumentMapperException($e->getMessage(), $e->getCode(), $e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ContainsElement $contains
|
||||
*
|
||||
* @return Type
|
||||
*
|
||||
* @throws ManifestDocumentMapperException
|
||||
*/
|
||||
private function mapType(ContainsElement $contains) {
|
||||
switch ($contains->getType()) {
|
||||
case 'application':
|
||||
return Type::application();
|
||||
case 'library':
|
||||
return Type::library();
|
||||
case 'extension':
|
||||
return $this->mapExtension($contains->getExtensionElement());
|
||||
}
|
||||
|
||||
throw new ManifestDocumentMapperException(
|
||||
sprintf('Unsupported type %s', $contains->getType())
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param CopyrightElement $copyright
|
||||
*
|
||||
* @return CopyrightInformation
|
||||
*
|
||||
* @throws InvalidUrlException
|
||||
* @throws InvalidEmailException
|
||||
*/
|
||||
private function mapCopyright(CopyrightElement $copyright) {
|
||||
$authors = new AuthorCollection();
|
||||
|
||||
foreach($copyright->getAuthorElements() as $authorElement) {
|
||||
$authors->add(
|
||||
new Author(
|
||||
$authorElement->getName(),
|
||||
new Email($authorElement->getEmail())
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$licenseElement = $copyright->getLicenseElement();
|
||||
$license = new License(
|
||||
$licenseElement->getType(),
|
||||
new Url($licenseElement->getUrl())
|
||||
);
|
||||
|
||||
return new CopyrightInformation(
|
||||
$authors,
|
||||
$license
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param RequiresElement $requires
|
||||
*
|
||||
* @return RequirementCollection
|
||||
*
|
||||
* @throws ManifestDocumentMapperException
|
||||
*/
|
||||
private function mapRequirements(RequiresElement $requires) {
|
||||
$collection = new RequirementCollection();
|
||||
$phpElement = $requires->getPHPElement();
|
||||
$parser = new VersionConstraintParser;
|
||||
|
||||
try {
|
||||
$versionConstraint = $parser->parse($phpElement->getVersion());
|
||||
} catch (VersionException $e) {
|
||||
throw new ManifestDocumentMapperException(
|
||||
sprintf('Unsupported version constraint - %s', $e->getMessage()),
|
||||
$e->getCode(),
|
||||
$e
|
||||
);
|
||||
}
|
||||
|
||||
$collection->add(
|
||||
new PhpVersionRequirement(
|
||||
$versionConstraint
|
||||
)
|
||||
);
|
||||
|
||||
if (!$phpElement->hasExtElements()) {
|
||||
return $collection;
|
||||
}
|
||||
|
||||
foreach($phpElement->getExtElements() as $extElement) {
|
||||
$collection->add(
|
||||
new PhpExtensionRequirement($extElement->getName())
|
||||
);
|
||||
}
|
||||
|
||||
return $collection;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ManifestDocument $document
|
||||
*
|
||||
* @return BundledComponentCollection
|
||||
*/
|
||||
private function mapBundledComponents(ManifestDocument $document) {
|
||||
$collection = new BundledComponentCollection();
|
||||
|
||||
if (!$document->hasBundlesElement()) {
|
||||
return $collection;
|
||||
}
|
||||
|
||||
foreach($document->getBundlesElement()->getComponentElements() as $componentElement) {
|
||||
$collection->add(
|
||||
new BundledComponent(
|
||||
$componentElement->getName(),
|
||||
new Version(
|
||||
$componentElement->getVersion()
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return $collection;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ExtensionElement $extension
|
||||
*
|
||||
* @return Extension
|
||||
*
|
||||
* @throws ManifestDocumentMapperException
|
||||
*/
|
||||
private function mapExtension(ExtensionElement $extension) {
|
||||
try {
|
||||
$parser = new VersionConstraintParser;
|
||||
$versionConstraint = $parser->parse($extension->getCompatible());
|
||||
|
||||
return Type::extension(
|
||||
new ApplicationName($extension->getFor()),
|
||||
$versionConstraint
|
||||
);
|
||||
} catch (VersionException $e) {
|
||||
throw new ManifestDocumentMapperException(
|
||||
sprintf('Unsupported version constraint - %s', $e->getMessage()),
|
||||
$e->getCode(),
|
||||
$e
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
66
Laravel/vendor/phar-io/manifest/src/ManifestLoader.php
vendored
Normal file
66
Laravel/vendor/phar-io/manifest/src/ManifestLoader.php
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of PharIo\Manifest.
|
||||
*
|
||||
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace PharIo\Manifest;
|
||||
|
||||
class ManifestLoader {
|
||||
/**
|
||||
* @param string $filename
|
||||
*
|
||||
* @return Manifest
|
||||
*
|
||||
* @throws ManifestLoaderException
|
||||
*/
|
||||
public static function fromFile($filename) {
|
||||
try {
|
||||
return (new ManifestDocumentMapper())->map(
|
||||
ManifestDocument::fromFile($filename)
|
||||
);
|
||||
} catch (Exception $e) {
|
||||
throw new ManifestLoaderException(
|
||||
sprintf('Loading %s failed.', $filename),
|
||||
$e->getCode(),
|
||||
$e
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $filename
|
||||
*
|
||||
* @return Manifest
|
||||
*
|
||||
* @throws ManifestLoaderException
|
||||
*/
|
||||
public static function fromPhar($filename) {
|
||||
return self::fromFile('phar://' . $filename . '/manifest.xml');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $manifest
|
||||
*
|
||||
* @return Manifest
|
||||
*
|
||||
* @throws ManifestLoaderException
|
||||
*/
|
||||
public static function fromString($manifest) {
|
||||
try {
|
||||
return (new ManifestDocumentMapper())->map(
|
||||
ManifestDocument::fromString($manifest)
|
||||
);
|
||||
} catch (Exception $e) {
|
||||
throw new ManifestLoaderException(
|
||||
'Processing string failed',
|
||||
$e->getCode(),
|
||||
$e
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
163
Laravel/vendor/phar-io/manifest/src/ManifestSerializer.php
vendored
Normal file
163
Laravel/vendor/phar-io/manifest/src/ManifestSerializer.php
vendored
Normal file
@@ -0,0 +1,163 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of PharIo\Manifest.
|
||||
*
|
||||
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace PharIo\Manifest;
|
||||
|
||||
use PharIo\Version\AnyVersionConstraint;
|
||||
use PharIo\Version\Version;
|
||||
use PharIo\Version\VersionConstraint;
|
||||
use XMLWriter;
|
||||
|
||||
class ManifestSerializer {
|
||||
/**
|
||||
* @var XMLWriter
|
||||
*/
|
||||
private $xmlWriter;
|
||||
|
||||
public function serializeToFile(Manifest $manifest, $filename) {
|
||||
file_put_contents(
|
||||
$filename,
|
||||
$this->serializeToString($manifest)
|
||||
);
|
||||
}
|
||||
|
||||
public function serializeToString(Manifest $manifest) {
|
||||
$this->startDocument();
|
||||
|
||||
$this->addContains($manifest->getName(), $manifest->getVersion(), $manifest->getType());
|
||||
$this->addCopyright($manifest->getCopyrightInformation());
|
||||
$this->addRequirements($manifest->getRequirements());
|
||||
$this->addBundles($manifest->getBundledComponents());
|
||||
|
||||
return $this->finishDocument();
|
||||
}
|
||||
|
||||
private function startDocument() {
|
||||
$xmlWriter = new XMLWriter();
|
||||
$xmlWriter->openMemory();
|
||||
$xmlWriter->setIndent(true);
|
||||
$xmlWriter->setIndentString(str_repeat(' ', 4));
|
||||
$xmlWriter->startDocument('1.0', 'UTF-8');
|
||||
$xmlWriter->startElement('phar');
|
||||
$xmlWriter->writeAttribute('xmlns', 'https://phar.io/xml/manifest/1.0');
|
||||
|
||||
$this->xmlWriter = $xmlWriter;
|
||||
}
|
||||
|
||||
private function finishDocument() {
|
||||
$this->xmlWriter->endElement();
|
||||
$this->xmlWriter->endDocument();
|
||||
|
||||
return $this->xmlWriter->outputMemory();
|
||||
}
|
||||
|
||||
private function addContains($name, Version $version, Type $type) {
|
||||
$this->xmlWriter->startElement('contains');
|
||||
$this->xmlWriter->writeAttribute('name', $name);
|
||||
$this->xmlWriter->writeAttribute('version', $version->getVersionString());
|
||||
|
||||
switch (true) {
|
||||
case $type->isApplication(): {
|
||||
$this->xmlWriter->writeAttribute('type', 'application');
|
||||
break;
|
||||
}
|
||||
|
||||
case $type->isLibrary(): {
|
||||
$this->xmlWriter->writeAttribute('type', 'library');
|
||||
break;
|
||||
}
|
||||
|
||||
case $type->isExtension(): {
|
||||
/* @var $type Extension */
|
||||
$this->xmlWriter->writeAttribute('type', 'extension');
|
||||
$this->addExtension($type->getApplicationName(), $type->getVersionConstraint());
|
||||
break;
|
||||
}
|
||||
|
||||
default: {
|
||||
$this->xmlWriter->writeAttribute('type', 'custom');
|
||||
}
|
||||
}
|
||||
|
||||
$this->xmlWriter->endElement();
|
||||
}
|
||||
|
||||
private function addCopyright(CopyrightInformation $copyrightInformation) {
|
||||
$this->xmlWriter->startElement('copyright');
|
||||
|
||||
foreach($copyrightInformation->getAuthors() as $author) {
|
||||
$this->xmlWriter->startElement('author');
|
||||
$this->xmlWriter->writeAttribute('name', $author->getName());
|
||||
$this->xmlWriter->writeAttribute('email', (string) $author->getEmail());
|
||||
$this->xmlWriter->endElement();
|
||||
}
|
||||
|
||||
$license = $copyrightInformation->getLicense();
|
||||
|
||||
$this->xmlWriter->startElement('license');
|
||||
$this->xmlWriter->writeAttribute('type', $license->getName());
|
||||
$this->xmlWriter->writeAttribute('url', $license->getUrl());
|
||||
$this->xmlWriter->endElement();
|
||||
|
||||
$this->xmlWriter->endElement();
|
||||
}
|
||||
|
||||
private function addRequirements(RequirementCollection $requirementCollection) {
|
||||
$phpRequirement = new AnyVersionConstraint();
|
||||
$extensions = [];
|
||||
|
||||
foreach($requirementCollection as $requirement) {
|
||||
if ($requirement instanceof PhpVersionRequirement) {
|
||||
$phpRequirement = $requirement->getVersionConstraint();
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($requirement instanceof PhpExtensionRequirement) {
|
||||
$extensions[] = (string) $requirement;
|
||||
}
|
||||
}
|
||||
|
||||
$this->xmlWriter->startElement('requires');
|
||||
$this->xmlWriter->startElement('php');
|
||||
$this->xmlWriter->writeAttribute('version', $phpRequirement->asString());
|
||||
|
||||
foreach($extensions as $extension) {
|
||||
$this->xmlWriter->startElement('ext');
|
||||
$this->xmlWriter->writeAttribute('name', $extension);
|
||||
$this->xmlWriter->endElement();
|
||||
}
|
||||
|
||||
$this->xmlWriter->endElement();
|
||||
$this->xmlWriter->endElement();
|
||||
}
|
||||
|
||||
private function addBundles(BundledComponentCollection $bundledComponentCollection) {
|
||||
if (count($bundledComponentCollection) === 0) {
|
||||
return;
|
||||
}
|
||||
$this->xmlWriter->startElement('bundles');
|
||||
|
||||
foreach($bundledComponentCollection as $bundledComponent) {
|
||||
$this->xmlWriter->startElement('component');
|
||||
$this->xmlWriter->writeAttribute('name', $bundledComponent->getName());
|
||||
$this->xmlWriter->writeAttribute('version', $bundledComponent->getVersion()->getVersionString());
|
||||
$this->xmlWriter->endElement();
|
||||
}
|
||||
|
||||
$this->xmlWriter->endElement();
|
||||
}
|
||||
|
||||
private function addExtension($application, VersionConstraint $versionConstraint) {
|
||||
$this->xmlWriter->startElement('extension');
|
||||
$this->xmlWriter->writeAttribute('for', $application);
|
||||
$this->xmlWriter->writeAttribute('compatible', $versionConstraint->asString());
|
||||
$this->xmlWriter->endElement();
|
||||
}
|
||||
}
|
14
Laravel/vendor/phar-io/manifest/src/exceptions/Exception.php
vendored
Normal file
14
Laravel/vendor/phar-io/manifest/src/exceptions/Exception.php
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of PharIo\Manifest.
|
||||
*
|
||||
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace PharIo\Manifest;
|
||||
|
||||
interface Exception {
|
||||
}
|
16
Laravel/vendor/phar-io/manifest/src/exceptions/InvalidApplicationNameException.php
vendored
Normal file
16
Laravel/vendor/phar-io/manifest/src/exceptions/InvalidApplicationNameException.php
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of PharIo\Manifest.
|
||||
*
|
||||
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace PharIo\Manifest;
|
||||
|
||||
class InvalidApplicationNameException extends \InvalidArgumentException implements Exception {
|
||||
const NotAString = 1;
|
||||
const InvalidFormat = 2;
|
||||
}
|
14
Laravel/vendor/phar-io/manifest/src/exceptions/InvalidEmailException.php
vendored
Normal file
14
Laravel/vendor/phar-io/manifest/src/exceptions/InvalidEmailException.php
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of PharIo\Manifest.
|
||||
*
|
||||
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace PharIo\Manifest;
|
||||
|
||||
class InvalidEmailException extends \InvalidArgumentException implements Exception {
|
||||
}
|
14
Laravel/vendor/phar-io/manifest/src/exceptions/InvalidUrlException.php
vendored
Normal file
14
Laravel/vendor/phar-io/manifest/src/exceptions/InvalidUrlException.php
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of PharIo\Manifest.
|
||||
*
|
||||
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace PharIo\Manifest;
|
||||
|
||||
class InvalidUrlException extends \InvalidArgumentException implements Exception {
|
||||
}
|
6
Laravel/vendor/phar-io/manifest/src/exceptions/ManifestDocumentException.php
vendored
Normal file
6
Laravel/vendor/phar-io/manifest/src/exceptions/ManifestDocumentException.php
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace PharIo\Manifest;
|
||||
|
||||
class ManifestDocumentException extends \RuntimeException implements Exception {
|
||||
}
|
6
Laravel/vendor/phar-io/manifest/src/exceptions/ManifestDocumentMapperException.php
vendored
Normal file
6
Laravel/vendor/phar-io/manifest/src/exceptions/ManifestDocumentMapperException.php
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace PharIo\Manifest;
|
||||
|
||||
class ManifestDocumentMapperException extends \RuntimeException implements Exception {
|
||||
}
|
6
Laravel/vendor/phar-io/manifest/src/exceptions/ManifestElementException.php
vendored
Normal file
6
Laravel/vendor/phar-io/manifest/src/exceptions/ManifestElementException.php
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace PharIo\Manifest;
|
||||
|
||||
class ManifestElementException extends \RuntimeException implements Exception {
|
||||
}
|
6
Laravel/vendor/phar-io/manifest/src/exceptions/ManifestLoaderException.php
vendored
Normal file
6
Laravel/vendor/phar-io/manifest/src/exceptions/ManifestLoaderException.php
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace PharIo\Manifest;
|
||||
|
||||
class ManifestLoaderException extends \Exception implements Exception {
|
||||
}
|
20
Laravel/vendor/phar-io/manifest/src/values/Application.php
vendored
Normal file
20
Laravel/vendor/phar-io/manifest/src/values/Application.php
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of PharIo\Manifest.
|
||||
*
|
||||
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace PharIo\Manifest;
|
||||
|
||||
class Application extends Type {
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isApplication() {
|
||||
return true;
|
||||
}
|
||||
}
|
65
Laravel/vendor/phar-io/manifest/src/values/ApplicationName.php
vendored
Normal file
65
Laravel/vendor/phar-io/manifest/src/values/ApplicationName.php
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of PharIo\Manifest.
|
||||
*
|
||||
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace PharIo\Manifest;
|
||||
|
||||
class ApplicationName {
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $name;
|
||||
|
||||
/**
|
||||
* ApplicationName constructor.
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @throws InvalidApplicationNameException
|
||||
*/
|
||||
public function __construct($name) {
|
||||
$this->ensureIsString($name);
|
||||
$this->ensureValidFormat($name);
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function __toString() {
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function isEqual(ApplicationName $name) {
|
||||
return $this->name === $name->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
*
|
||||
* @throws InvalidApplicationNameException
|
||||
*/
|
||||
private function ensureValidFormat($name) {
|
||||
if (!preg_match('#\w/\w#', $name)) {
|
||||
throw new InvalidApplicationNameException(
|
||||
sprintf('Format of name "%s" is not valid - expected: vendor/packagename', $name),
|
||||
InvalidApplicationNameException::InvalidFormat
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private function ensureIsString($name) {
|
||||
if (!is_string($name)) {
|
||||
throw new InvalidApplicationNameException(
|
||||
'Name must be a string',
|
||||
InvalidApplicationNameException::NotAString
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
57
Laravel/vendor/phar-io/manifest/src/values/Author.php
vendored
Normal file
57
Laravel/vendor/phar-io/manifest/src/values/Author.php
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of PharIo\Manifest.
|
||||
*
|
||||
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace PharIo\Manifest;
|
||||
|
||||
class Author {
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $name;
|
||||
|
||||
/**
|
||||
* @var Email
|
||||
*/
|
||||
private $email;
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param Email $email
|
||||
*/
|
||||
public function __construct($name, Email $email) {
|
||||
$this->name = $name;
|
||||
$this->email = $email;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getName() {
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Email
|
||||
*/
|
||||
public function getEmail() {
|
||||
return $this->email;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function __toString() {
|
||||
return sprintf(
|
||||
'%s <%s>',
|
||||
$this->name,
|
||||
$this->email
|
||||
);
|
||||
}
|
||||
}
|
43
Laravel/vendor/phar-io/manifest/src/values/AuthorCollection.php
vendored
Normal file
43
Laravel/vendor/phar-io/manifest/src/values/AuthorCollection.php
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of PharIo\Manifest.
|
||||
*
|
||||
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace PharIo\Manifest;
|
||||
|
||||
class AuthorCollection implements \Countable, \IteratorAggregate {
|
||||
/**
|
||||
* @var Author[]
|
||||
*/
|
||||
private $authors = [];
|
||||
|
||||
public function add(Author $author) {
|
||||
$this->authors[] = $author;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Author[]
|
||||
*/
|
||||
public function getAuthors() {
|
||||
return $this->authors;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function count() {
|
||||
return count($this->authors);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return AuthorCollectionIterator
|
||||
*/
|
||||
public function getIterator() {
|
||||
return new AuthorCollectionIterator($this);
|
||||
}
|
||||
}
|
56
Laravel/vendor/phar-io/manifest/src/values/AuthorCollectionIterator.php
vendored
Normal file
56
Laravel/vendor/phar-io/manifest/src/values/AuthorCollectionIterator.php
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of PharIo\Manifest.
|
||||
*
|
||||
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace PharIo\Manifest;
|
||||
|
||||
class AuthorCollectionIterator implements \Iterator {
|
||||
/**
|
||||
* @var Author[]
|
||||
*/
|
||||
private $authors = [];
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private $position;
|
||||
|
||||
public function __construct(AuthorCollection $authors) {
|
||||
$this->authors = $authors->getAuthors();
|
||||
}
|
||||
|
||||
public function rewind() {
|
||||
$this->position = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function valid() {
|
||||
return $this->position < count($this->authors);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function key() {
|
||||
return $this->position;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Author
|
||||
*/
|
||||
public function current() {
|
||||
return $this->authors[$this->position];
|
||||
}
|
||||
|
||||
public function next() {
|
||||
$this->position++;
|
||||
}
|
||||
}
|
48
Laravel/vendor/phar-io/manifest/src/values/BundledComponent.php
vendored
Normal file
48
Laravel/vendor/phar-io/manifest/src/values/BundledComponent.php
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of PharIo\Manifest.
|
||||
*
|
||||
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace PharIo\Manifest;
|
||||
|
||||
use PharIo\Version\Version;
|
||||
|
||||
class BundledComponent {
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $name;
|
||||
|
||||
/**
|
||||
* @var Version
|
||||
*/
|
||||
private $version;
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param Version $version
|
||||
*/
|
||||
public function __construct($name, Version $version) {
|
||||
$this->name = $name;
|
||||
$this->version = $version;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getName() {
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Version
|
||||
*/
|
||||
public function getVersion() {
|
||||
return $this->version;
|
||||
}
|
||||
}
|
43
Laravel/vendor/phar-io/manifest/src/values/BundledComponentCollection.php
vendored
Normal file
43
Laravel/vendor/phar-io/manifest/src/values/BundledComponentCollection.php
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of PharIo\Manifest.
|
||||
*
|
||||
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace PharIo\Manifest;
|
||||
|
||||
class BundledComponentCollection implements \Countable, \IteratorAggregate {
|
||||
/**
|
||||
* @var BundledComponent[]
|
||||
*/
|
||||
private $bundledComponents = [];
|
||||
|
||||
public function add(BundledComponent $bundledComponent) {
|
||||
$this->bundledComponents[] = $bundledComponent;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return BundledComponent[]
|
||||
*/
|
||||
public function getBundledComponents() {
|
||||
return $this->bundledComponents;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function count() {
|
||||
return count($this->bundledComponents);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return BundledComponentCollectionIterator
|
||||
*/
|
||||
public function getIterator() {
|
||||
return new BundledComponentCollectionIterator($this);
|
||||
}
|
||||
}
|
56
Laravel/vendor/phar-io/manifest/src/values/BundledComponentCollectionIterator.php
vendored
Normal file
56
Laravel/vendor/phar-io/manifest/src/values/BundledComponentCollectionIterator.php
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of PharIo\Manifest.
|
||||
*
|
||||
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace PharIo\Manifest;
|
||||
|
||||
class BundledComponentCollectionIterator implements \Iterator {
|
||||
/**
|
||||
* @var BundledComponent[]
|
||||
*/
|
||||
private $bundledComponents = [];
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private $position;
|
||||
|
||||
public function __construct(BundledComponentCollection $bundledComponents) {
|
||||
$this->bundledComponents = $bundledComponents->getBundledComponents();
|
||||
}
|
||||
|
||||
public function rewind() {
|
||||
$this->position = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function valid() {
|
||||
return $this->position < count($this->bundledComponents);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function key() {
|
||||
return $this->position;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return BundledComponent
|
||||
*/
|
||||
public function current() {
|
||||
return $this->bundledComponents[$this->position];
|
||||
}
|
||||
|
||||
public function next() {
|
||||
$this->position++;
|
||||
}
|
||||
}
|
42
Laravel/vendor/phar-io/manifest/src/values/CopyrightInformation.php
vendored
Normal file
42
Laravel/vendor/phar-io/manifest/src/values/CopyrightInformation.php
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of PharIo\Manifest.
|
||||
*
|
||||
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace PharIo\Manifest;
|
||||
|
||||
class CopyrightInformation {
|
||||
/**
|
||||
* @var AuthorCollection
|
||||
*/
|
||||
private $authors;
|
||||
|
||||
/**
|
||||
* @var License
|
||||
*/
|
||||
private $license;
|
||||
|
||||
public function __construct(AuthorCollection $authors, License $license) {
|
||||
$this->authors = $authors;
|
||||
$this->license = $license;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return AuthorCollection
|
||||
*/
|
||||
public function getAuthors() {
|
||||
return $this->authors;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return License
|
||||
*/
|
||||
public function getLicense() {
|
||||
return $this->license;
|
||||
}
|
||||
}
|
47
Laravel/vendor/phar-io/manifest/src/values/Email.php
vendored
Normal file
47
Laravel/vendor/phar-io/manifest/src/values/Email.php
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of PharIo\Manifest.
|
||||
*
|
||||
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace PharIo\Manifest;
|
||||
|
||||
class Email {
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $email;
|
||||
|
||||
/**
|
||||
* @param string $email
|
||||
*
|
||||
* @throws InvalidEmailException
|
||||
*/
|
||||
public function __construct($email) {
|
||||
$this->ensureEmailIsValid($email);
|
||||
|
||||
$this->email = $email;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function __toString() {
|
||||
return $this->email;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $url
|
||||
*
|
||||
* @throws InvalidEmailException
|
||||
*/
|
||||
private function ensureEmailIsValid($url) {
|
||||
if (filter_var($url, \FILTER_VALIDATE_EMAIL) === false) {
|
||||
throw new InvalidEmailException;
|
||||
}
|
||||
}
|
||||
}
|
75
Laravel/vendor/phar-io/manifest/src/values/Extension.php
vendored
Normal file
75
Laravel/vendor/phar-io/manifest/src/values/Extension.php
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of PharIo\Manifest.
|
||||
*
|
||||
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace PharIo\Manifest;
|
||||
|
||||
use PharIo\Version\Version;
|
||||
use PharIo\Version\VersionConstraint;
|
||||
|
||||
class Extension extends Type {
|
||||
/**
|
||||
* @var ApplicationName
|
||||
*/
|
||||
private $application;
|
||||
|
||||
/**
|
||||
* @var VersionConstraint
|
||||
*/
|
||||
private $versionConstraint;
|
||||
|
||||
/**
|
||||
* @param ApplicationName $application
|
||||
* @param VersionConstraint $versionConstraint
|
||||
*/
|
||||
public function __construct(ApplicationName $application, VersionConstraint $versionConstraint) {
|
||||
$this->application = $application;
|
||||
$this->versionConstraint = $versionConstraint;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ApplicationName
|
||||
*/
|
||||
public function getApplicationName() {
|
||||
return $this->application;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return VersionConstraint
|
||||
*/
|
||||
public function getVersionConstraint() {
|
||||
return $this->versionConstraint;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isExtension() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ApplicationName $name
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isExtensionFor(ApplicationName $name) {
|
||||
return $this->application->isEqual($name);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ApplicationName $name
|
||||
* @param Version $version
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isCompatibleWith(ApplicationName $name, Version $version) {
|
||||
return $this->isExtensionFor($name) && $this->versionConstraint->complies($version);
|
||||
}
|
||||
}
|
20
Laravel/vendor/phar-io/manifest/src/values/Library.php
vendored
Normal file
20
Laravel/vendor/phar-io/manifest/src/values/Library.php
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of PharIo\Manifest.
|
||||
*
|
||||
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace PharIo\Manifest;
|
||||
|
||||
class Library extends Type {
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isLibrary() {
|
||||
return true;
|
||||
}
|
||||
}
|
42
Laravel/vendor/phar-io/manifest/src/values/License.php
vendored
Normal file
42
Laravel/vendor/phar-io/manifest/src/values/License.php
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of PharIo\Manifest.
|
||||
*
|
||||
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace PharIo\Manifest;
|
||||
|
||||
class License {
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $name;
|
||||
|
||||
/**
|
||||
* @var Url
|
||||
*/
|
||||
private $url;
|
||||
|
||||
public function __construct($name, Url $url) {
|
||||
$this->name = $name;
|
||||
$this->url = $url;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getName() {
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Url
|
||||
*/
|
||||
public function getUrl() {
|
||||
return $this->url;
|
||||
}
|
||||
}
|
138
Laravel/vendor/phar-io/manifest/src/values/Manifest.php
vendored
Normal file
138
Laravel/vendor/phar-io/manifest/src/values/Manifest.php
vendored
Normal file
@@ -0,0 +1,138 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of PharIo\Manifest.
|
||||
*
|
||||
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace PharIo\Manifest;
|
||||
|
||||
use PharIo\Version\Version;
|
||||
|
||||
class Manifest {
|
||||
/**
|
||||
* @var ApplicationName
|
||||
*/
|
||||
private $name;
|
||||
|
||||
/**
|
||||
* @var Version
|
||||
*/
|
||||
private $version;
|
||||
|
||||
/**
|
||||
* @var Type
|
||||
*/
|
||||
private $type;
|
||||
|
||||
/**
|
||||
* @var CopyrightInformation
|
||||
*/
|
||||
private $copyrightInformation;
|
||||
|
||||
/**
|
||||
* @var RequirementCollection
|
||||
*/
|
||||
private $requirements;
|
||||
|
||||
/**
|
||||
* @var BundledComponentCollection
|
||||
*/
|
||||
private $bundledComponents;
|
||||
|
||||
public function __construct(ApplicationName $name, Version $version, Type $type, CopyrightInformation $copyrightInformation, RequirementCollection $requirements, BundledComponentCollection $bundledComponents) {
|
||||
$this->name = $name;
|
||||
$this->version = $version;
|
||||
$this->type = $type;
|
||||
$this->copyrightInformation = $copyrightInformation;
|
||||
$this->requirements = $requirements;
|
||||
$this->bundledComponents = $bundledComponents;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ApplicationName
|
||||
*/
|
||||
public function getName() {
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Version
|
||||
*/
|
||||
public function getVersion() {
|
||||
return $this->version;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Type
|
||||
*/
|
||||
public function getType() {
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return CopyrightInformation
|
||||
*/
|
||||
public function getCopyrightInformation() {
|
||||
return $this->copyrightInformation;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return RequirementCollection
|
||||
*/
|
||||
public function getRequirements() {
|
||||
return $this->requirements;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return BundledComponentCollection
|
||||
*/
|
||||
public function getBundledComponents() {
|
||||
return $this->bundledComponents;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isApplication() {
|
||||
return $this->type->isApplication();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isLibrary() {
|
||||
return $this->type->isLibrary();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isExtension() {
|
||||
return $this->type->isExtension();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ApplicationName $application
|
||||
* @param Version|null $version
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isExtensionFor(ApplicationName $application, Version $version = null) {
|
||||
if (!$this->isExtension()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/** @var Extension $type */
|
||||
$type = $this->type;
|
||||
|
||||
if ($version !== null) {
|
||||
return $type->isCompatibleWith($application, $version);
|
||||
}
|
||||
|
||||
return $type->isExtensionFor($application);
|
||||
}
|
||||
}
|
32
Laravel/vendor/phar-io/manifest/src/values/PhpExtensionRequirement.php
vendored
Normal file
32
Laravel/vendor/phar-io/manifest/src/values/PhpExtensionRequirement.php
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of PharIo\Manifest.
|
||||
*
|
||||
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace PharIo\Manifest;
|
||||
|
||||
class PhpExtensionRequirement implements Requirement {
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $extension;
|
||||
|
||||
/**
|
||||
* @param string $extension
|
||||
*/
|
||||
public function __construct($extension) {
|
||||
$this->extension = $extension;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function __toString() {
|
||||
return $this->extension;
|
||||
}
|
||||
}
|
31
Laravel/vendor/phar-io/manifest/src/values/PhpVersionRequirement.php
vendored
Normal file
31
Laravel/vendor/phar-io/manifest/src/values/PhpVersionRequirement.php
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of PharIo\Manifest.
|
||||
*
|
||||
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace PharIo\Manifest;
|
||||
|
||||
use PharIo\Version\VersionConstraint;
|
||||
|
||||
class PhpVersionRequirement implements Requirement {
|
||||
/**
|
||||
* @var VersionConstraint
|
||||
*/
|
||||
private $versionConstraint;
|
||||
|
||||
public function __construct(VersionConstraint $versionConstraint) {
|
||||
$this->versionConstraint = $versionConstraint;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return VersionConstraint
|
||||
*/
|
||||
public function getVersionConstraint() {
|
||||
return $this->versionConstraint;
|
||||
}
|
||||
}
|
14
Laravel/vendor/phar-io/manifest/src/values/Requirement.php
vendored
Normal file
14
Laravel/vendor/phar-io/manifest/src/values/Requirement.php
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of PharIo\Manifest.
|
||||
*
|
||||
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace PharIo\Manifest;
|
||||
|
||||
interface Requirement {
|
||||
}
|
43
Laravel/vendor/phar-io/manifest/src/values/RequirementCollection.php
vendored
Normal file
43
Laravel/vendor/phar-io/manifest/src/values/RequirementCollection.php
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of PharIo\Manifest.
|
||||
*
|
||||
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace PharIo\Manifest;
|
||||
|
||||
class RequirementCollection implements \Countable, \IteratorAggregate {
|
||||
/**
|
||||
* @var Requirement[]
|
||||
*/
|
||||
private $requirements = [];
|
||||
|
||||
public function add(Requirement $requirement) {
|
||||
$this->requirements[] = $requirement;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Requirement[]
|
||||
*/
|
||||
public function getRequirements() {
|
||||
return $this->requirements;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function count() {
|
||||
return count($this->requirements);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return RequirementCollectionIterator
|
||||
*/
|
||||
public function getIterator() {
|
||||
return new RequirementCollectionIterator($this);
|
||||
}
|
||||
}
|
56
Laravel/vendor/phar-io/manifest/src/values/RequirementCollectionIterator.php
vendored
Normal file
56
Laravel/vendor/phar-io/manifest/src/values/RequirementCollectionIterator.php
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of PharIo\Manifest.
|
||||
*
|
||||
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace PharIo\Manifest;
|
||||
|
||||
class RequirementCollectionIterator implements \Iterator {
|
||||
/**
|
||||
* @var Requirement[]
|
||||
*/
|
||||
private $requirements = [];
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private $position;
|
||||
|
||||
public function __construct(RequirementCollection $requirements) {
|
||||
$this->requirements = $requirements->getRequirements();
|
||||
}
|
||||
|
||||
public function rewind() {
|
||||
$this->position = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function valid() {
|
||||
return $this->position < count($this->requirements);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function key() {
|
||||
return $this->position;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Requirement
|
||||
*/
|
||||
public function current() {
|
||||
return $this->requirements[$this->position];
|
||||
}
|
||||
|
||||
public function next() {
|
||||
$this->position++;
|
||||
}
|
||||
}
|
60
Laravel/vendor/phar-io/manifest/src/values/Type.php
vendored
Normal file
60
Laravel/vendor/phar-io/manifest/src/values/Type.php
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of PharIo\Manifest.
|
||||
*
|
||||
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace PharIo\Manifest;
|
||||
|
||||
use PharIo\Version\VersionConstraint;
|
||||
|
||||
abstract class Type {
|
||||
/**
|
||||
* @return Application
|
||||
*/
|
||||
public static function application() {
|
||||
return new Application;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Library
|
||||
*/
|
||||
public static function library() {
|
||||
return new Library;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ApplicationName $application
|
||||
* @param VersionConstraint $versionConstraint
|
||||
*
|
||||
* @return Extension
|
||||
*/
|
||||
public static function extension(ApplicationName $application, VersionConstraint $versionConstraint) {
|
||||
return new Extension($application, $versionConstraint);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isApplication() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isLibrary() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isExtension() {
|
||||
return false;
|
||||
}
|
||||
}
|
47
Laravel/vendor/phar-io/manifest/src/values/Url.php
vendored
Normal file
47
Laravel/vendor/phar-io/manifest/src/values/Url.php
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of PharIo\Manifest.
|
||||
*
|
||||
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace PharIo\Manifest;
|
||||
|
||||
class Url {
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $url;
|
||||
|
||||
/**
|
||||
* @param string $url
|
||||
*
|
||||
* @throws InvalidUrlException
|
||||
*/
|
||||
public function __construct($url) {
|
||||
$this->ensureUrlIsValid($url);
|
||||
|
||||
$this->url = $url;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function __toString() {
|
||||
return $this->url;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $url
|
||||
*
|
||||
* @throws InvalidUrlException
|
||||
*/
|
||||
private function ensureUrlIsValid($url) {
|
||||
if (filter_var($url, \FILTER_VALIDATE_URL) === false) {
|
||||
throw new InvalidUrlException;
|
||||
}
|
||||
}
|
||||
}
|
21
Laravel/vendor/phar-io/manifest/src/xml/AuthorElement.php
vendored
Normal file
21
Laravel/vendor/phar-io/manifest/src/xml/AuthorElement.php
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of PharIo\Manifest.
|
||||
*
|
||||
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace PharIo\Manifest;
|
||||
|
||||
class AuthorElement extends ManifestElement {
|
||||
public function getName() {
|
||||
return $this->getAttributeValue('name');
|
||||
}
|
||||
|
||||
public function getEmail() {
|
||||
return $this->getAttributeValue('email');
|
||||
}
|
||||
}
|
19
Laravel/vendor/phar-io/manifest/src/xml/AuthorElementCollection.php
vendored
Normal file
19
Laravel/vendor/phar-io/manifest/src/xml/AuthorElementCollection.php
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of PharIo\Manifest.
|
||||
*
|
||||
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace PharIo\Manifest;
|
||||
|
||||
class AuthorElementCollection extends ElementCollection {
|
||||
public function current() {
|
||||
return new AuthorElement(
|
||||
$this->getCurrentElement()
|
||||
);
|
||||
}
|
||||
}
|
19
Laravel/vendor/phar-io/manifest/src/xml/BundlesElement.php
vendored
Normal file
19
Laravel/vendor/phar-io/manifest/src/xml/BundlesElement.php
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of PharIo\Manifest.
|
||||
*
|
||||
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace PharIo\Manifest;
|
||||
|
||||
class BundlesElement extends ManifestElement {
|
||||
public function getComponentElements() {
|
||||
return new ComponentElementCollection(
|
||||
$this->getChildrenByName('component')
|
||||
);
|
||||
}
|
||||
}
|
21
Laravel/vendor/phar-io/manifest/src/xml/ComponentElement.php
vendored
Normal file
21
Laravel/vendor/phar-io/manifest/src/xml/ComponentElement.php
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of PharIo\Manifest.
|
||||
*
|
||||
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace PharIo\Manifest;
|
||||
|
||||
class ComponentElement extends ManifestElement {
|
||||
public function getName() {
|
||||
return $this->getAttributeValue('name');
|
||||
}
|
||||
|
||||
public function getVersion() {
|
||||
return $this->getAttributeValue('version');
|
||||
}
|
||||
}
|
19
Laravel/vendor/phar-io/manifest/src/xml/ComponentElementCollection.php
vendored
Normal file
19
Laravel/vendor/phar-io/manifest/src/xml/ComponentElementCollection.php
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of PharIo\Manifest.
|
||||
*
|
||||
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace PharIo\Manifest;
|
||||
|
||||
class ComponentElementCollection extends ElementCollection {
|
||||
public function current() {
|
||||
return new ComponentElement(
|
||||
$this->getCurrentElement()
|
||||
);
|
||||
}
|
||||
}
|
31
Laravel/vendor/phar-io/manifest/src/xml/ContainsElement.php
vendored
Normal file
31
Laravel/vendor/phar-io/manifest/src/xml/ContainsElement.php
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of PharIo\Manifest.
|
||||
*
|
||||
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace PharIo\Manifest;
|
||||
|
||||
class ContainsElement extends ManifestElement {
|
||||
public function getName() {
|
||||
return $this->getAttributeValue('name');
|
||||
}
|
||||
|
||||
public function getVersion() {
|
||||
return $this->getAttributeValue('version');
|
||||
}
|
||||
|
||||
public function getType() {
|
||||
return $this->getAttributeValue('type');
|
||||
}
|
||||
|
||||
public function getExtensionElement() {
|
||||
return new ExtensionElement(
|
||||
$this->getChildByName('extension')
|
||||
);
|
||||
}
|
||||
}
|
25
Laravel/vendor/phar-io/manifest/src/xml/CopyrightElement.php
vendored
Normal file
25
Laravel/vendor/phar-io/manifest/src/xml/CopyrightElement.php
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of PharIo\Manifest.
|
||||
*
|
||||
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace PharIo\Manifest;
|
||||
|
||||
class CopyrightElement extends ManifestElement {
|
||||
public function getAuthorElements() {
|
||||
return new AuthorElementCollection(
|
||||
$this->getChildrenByName('author')
|
||||
);
|
||||
}
|
||||
|
||||
public function getLicenseElement() {
|
||||
return new LicenseElement(
|
||||
$this->getChildByName('license')
|
||||
);
|
||||
}
|
||||
}
|
58
Laravel/vendor/phar-io/manifest/src/xml/ElementCollection.php
vendored
Normal file
58
Laravel/vendor/phar-io/manifest/src/xml/ElementCollection.php
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of PharIo\Manifest.
|
||||
*
|
||||
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace PharIo\Manifest;
|
||||
|
||||
use DOMElement;
|
||||
use DOMNodeList;
|
||||
|
||||
abstract class ElementCollection implements \Iterator {
|
||||
/**
|
||||
* @var DOMNodeList
|
||||
*/
|
||||
private $nodeList;
|
||||
|
||||
private $position;
|
||||
|
||||
/**
|
||||
* ElementCollection constructor.
|
||||
*
|
||||
* @param DOMNodeList $nodeList
|
||||
*/
|
||||
public function __construct(DOMNodeList $nodeList) {
|
||||
$this->nodeList = $nodeList;
|
||||
$this->position = 0;
|
||||
}
|
||||
|
||||
abstract public function current();
|
||||
|
||||
/**
|
||||
* @return DOMElement
|
||||
*/
|
||||
protected function getCurrentElement() {
|
||||
return $this->nodeList->item($this->position);
|
||||
}
|
||||
|
||||
public function next() {
|
||||
$this->position++;
|
||||
}
|
||||
|
||||
public function key() {
|
||||
return $this->position;
|
||||
}
|
||||
|
||||
public function valid() {
|
||||
return $this->position < $this->nodeList->length;
|
||||
}
|
||||
|
||||
public function rewind() {
|
||||
$this->position = 0;
|
||||
}
|
||||
}
|
17
Laravel/vendor/phar-io/manifest/src/xml/ExtElement.php
vendored
Normal file
17
Laravel/vendor/phar-io/manifest/src/xml/ExtElement.php
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of PharIo\Manifest.
|
||||
*
|
||||
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace PharIo\Manifest;
|
||||
|
||||
class ExtElement extends ManifestElement {
|
||||
public function getName() {
|
||||
return $this->getAttributeValue('name');
|
||||
}
|
||||
}
|
20
Laravel/vendor/phar-io/manifest/src/xml/ExtElementCollection.php
vendored
Normal file
20
Laravel/vendor/phar-io/manifest/src/xml/ExtElementCollection.php
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of PharIo\Manifest.
|
||||
*
|
||||
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace PharIo\Manifest;
|
||||
|
||||
class ExtElementCollection extends ElementCollection {
|
||||
public function current() {
|
||||
return new ExtElement(
|
||||
$this->getCurrentElement()
|
||||
);
|
||||
}
|
||||
|
||||
}
|
21
Laravel/vendor/phar-io/manifest/src/xml/ExtensionElement.php
vendored
Normal file
21
Laravel/vendor/phar-io/manifest/src/xml/ExtensionElement.php
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of PharIo\Manifest.
|
||||
*
|
||||
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace PharIo\Manifest;
|
||||
|
||||
class ExtensionElement extends ManifestElement {
|
||||
public function getFor() {
|
||||
return $this->getAttributeValue('for');
|
||||
}
|
||||
|
||||
public function getCompatible() {
|
||||
return $this->getAttributeValue('compatible');
|
||||
}
|
||||
}
|
21
Laravel/vendor/phar-io/manifest/src/xml/LicenseElement.php
vendored
Normal file
21
Laravel/vendor/phar-io/manifest/src/xml/LicenseElement.php
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of PharIo\Manifest.
|
||||
*
|
||||
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace PharIo\Manifest;
|
||||
|
||||
class LicenseElement extends ManifestElement {
|
||||
public function getType() {
|
||||
return $this->getAttributeValue('type');
|
||||
}
|
||||
|
||||
public function getUrl() {
|
||||
return $this->getAttributeValue('url');
|
||||
}
|
||||
}
|
118
Laravel/vendor/phar-io/manifest/src/xml/ManifestDocument.php
vendored
Normal file
118
Laravel/vendor/phar-io/manifest/src/xml/ManifestDocument.php
vendored
Normal file
@@ -0,0 +1,118 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of PharIo\Manifest.
|
||||
*
|
||||
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace PharIo\Manifest;
|
||||
|
||||
use DOMDocument;
|
||||
use DOMElement;
|
||||
|
||||
class ManifestDocument {
|
||||
const XMLNS = 'https://phar.io/xml/manifest/1.0';
|
||||
|
||||
/**
|
||||
* @var DOMDocument
|
||||
*/
|
||||
private $dom;
|
||||
|
||||
/**
|
||||
* ManifestDocument constructor.
|
||||
*
|
||||
* @param DOMDocument $dom
|
||||
*/
|
||||
private function __construct(DOMDocument $dom) {
|
||||
$this->ensureCorrectDocumentType($dom);
|
||||
|
||||
$this->dom = $dom;
|
||||
}
|
||||
|
||||
public static function fromFile($filename) {
|
||||
if (!file_exists($filename)) {
|
||||
throw new ManifestDocumentException(
|
||||
sprintf('File "%s" not found', $filename)
|
||||
);
|
||||
}
|
||||
|
||||
return self::fromString(
|
||||
file_get_contents($filename)
|
||||
);
|
||||
}
|
||||
|
||||
public static function fromString($xmlString) {
|
||||
$prev = libxml_use_internal_errors(true);
|
||||
libxml_clear_errors();
|
||||
|
||||
$dom = new DOMDocument();
|
||||
$dom->loadXML($xmlString);
|
||||
|
||||
$errors = libxml_get_errors();
|
||||
libxml_use_internal_errors($prev);
|
||||
|
||||
if (count($errors) !== 0) {
|
||||
throw new ManifestDocumentLoadingException($errors);
|
||||
}
|
||||
|
||||
return new self($dom);
|
||||
}
|
||||
|
||||
public function getContainsElement() {
|
||||
return new ContainsElement(
|
||||
$this->fetchElementByName('contains')
|
||||
);
|
||||
}
|
||||
|
||||
public function getCopyrightElement() {
|
||||
return new CopyrightElement(
|
||||
$this->fetchElementByName('copyright')
|
||||
);
|
||||
}
|
||||
|
||||
public function getRequiresElement() {
|
||||
return new RequiresElement(
|
||||
$this->fetchElementByName('requires')
|
||||
);
|
||||
}
|
||||
|
||||
public function hasBundlesElement() {
|
||||
return $this->dom->getElementsByTagNameNS(self::XMLNS, 'bundles')->length === 1;
|
||||
}
|
||||
|
||||
public function getBundlesElement() {
|
||||
return new BundlesElement(
|
||||
$this->fetchElementByName('bundles')
|
||||
);
|
||||
}
|
||||
|
||||
private function ensureCorrectDocumentType(DOMDocument $dom) {
|
||||
$root = $dom->documentElement;
|
||||
|
||||
if ($root->localName !== 'phar' || $root->namespaceURI !== self::XMLNS) {
|
||||
throw new ManifestDocumentException('Not a phar.io manifest document');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $elementName
|
||||
*
|
||||
* @return DOMElement
|
||||
*
|
||||
* @throws ManifestDocumentException
|
||||
*/
|
||||
private function fetchElementByName($elementName) {
|
||||
$element = $this->dom->getElementsByTagNameNS(self::XMLNS, $elementName)->item(0);
|
||||
|
||||
if (!$element instanceof DOMElement) {
|
||||
throw new ManifestDocumentException(
|
||||
sprintf('Element %s missing', $elementName)
|
||||
);
|
||||
}
|
||||
|
||||
return $element;
|
||||
}
|
||||
}
|
48
Laravel/vendor/phar-io/manifest/src/xml/ManifestDocumentLoadingException.php
vendored
Normal file
48
Laravel/vendor/phar-io/manifest/src/xml/ManifestDocumentLoadingException.php
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of PharIo\Manifest.
|
||||
*
|
||||
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace PharIo\Manifest;
|
||||
|
||||
use LibXMLError;
|
||||
|
||||
class ManifestDocumentLoadingException extends \Exception implements Exception {
|
||||
/**
|
||||
* @var LibXMLError[]
|
||||
*/
|
||||
private $libxmlErrors;
|
||||
|
||||
/**
|
||||
* ManifestDocumentLoadingException constructor.
|
||||
*
|
||||
* @param LibXMLError[] $libxmlErrors
|
||||
*/
|
||||
public function __construct(array $libxmlErrors) {
|
||||
$this->libxmlErrors = $libxmlErrors;
|
||||
$first = $this->libxmlErrors[0];
|
||||
|
||||
parent::__construct(
|
||||
sprintf(
|
||||
'%s (Line: %d / Column: %d / File: %s)',
|
||||
$first->message,
|
||||
$first->line,
|
||||
$first->column,
|
||||
$first->file
|
||||
),
|
||||
$first->code
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return LibXMLError[]
|
||||
*/
|
||||
public function getLibxmlErrors() {
|
||||
return $this->libxmlErrors;
|
||||
}
|
||||
}
|
100
Laravel/vendor/phar-io/manifest/src/xml/ManifestElement.php
vendored
Normal file
100
Laravel/vendor/phar-io/manifest/src/xml/ManifestElement.php
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of PharIo\Manifest.
|
||||
*
|
||||
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace PharIo\Manifest;
|
||||
|
||||
use DOMElement;
|
||||
use DOMNodeList;
|
||||
|
||||
class ManifestElement {
|
||||
const XMLNS = 'https://phar.io/xml/manifest/1.0';
|
||||
|
||||
/**
|
||||
* @var DOMElement
|
||||
*/
|
||||
private $element;
|
||||
|
||||
/**
|
||||
* ContainsElement constructor.
|
||||
*
|
||||
* @param DOMElement $element
|
||||
*/
|
||||
public function __construct(DOMElement $element) {
|
||||
$this->element = $element;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @throws ManifestElementException
|
||||
*/
|
||||
protected function getAttributeValue($name) {
|
||||
if (!$this->element->hasAttribute($name)) {
|
||||
throw new ManifestElementException(
|
||||
sprintf(
|
||||
'Attribute %s not set on element %s',
|
||||
$name,
|
||||
$this->element->localName
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return $this->element->getAttribute($name);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $elementName
|
||||
*
|
||||
* @return DOMElement
|
||||
*
|
||||
* @throws ManifestElementException
|
||||
*/
|
||||
protected function getChildByName($elementName) {
|
||||
$element = $this->element->getElementsByTagNameNS(self::XMLNS, $elementName)->item(0);
|
||||
|
||||
if (!$element instanceof DOMElement) {
|
||||
throw new ManifestElementException(
|
||||
sprintf('Element %s missing', $elementName)
|
||||
);
|
||||
}
|
||||
|
||||
return $element;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $elementName
|
||||
*
|
||||
* @return DOMNodeList
|
||||
*
|
||||
* @throws ManifestElementException
|
||||
*/
|
||||
protected function getChildrenByName($elementName) {
|
||||
$elementList = $this->element->getElementsByTagNameNS(self::XMLNS, $elementName);
|
||||
|
||||
if ($elementList->length === 0) {
|
||||
throw new ManifestElementException(
|
||||
sprintf('Element(s) %s missing', $elementName)
|
||||
);
|
||||
}
|
||||
|
||||
return $elementList;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $elementName
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function hasChild($elementName) {
|
||||
return $this->element->getElementsByTagNameNS(self::XMLNS, $elementName)->length !== 0;
|
||||
}
|
||||
}
|
27
Laravel/vendor/phar-io/manifest/src/xml/PhpElement.php
vendored
Normal file
27
Laravel/vendor/phar-io/manifest/src/xml/PhpElement.php
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of PharIo\Manifest.
|
||||
*
|
||||
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace PharIo\Manifest;
|
||||
|
||||
class PhpElement extends ManifestElement {
|
||||
public function getVersion() {
|
||||
return $this->getAttributeValue('version');
|
||||
}
|
||||
|
||||
public function hasExtElements() {
|
||||
return $this->hasChild('ext');
|
||||
}
|
||||
|
||||
public function getExtElements() {
|
||||
return new ExtElementCollection(
|
||||
$this->getChildrenByName('ext')
|
||||
);
|
||||
}
|
||||
}
|
19
Laravel/vendor/phar-io/manifest/src/xml/RequiresElement.php
vendored
Normal file
19
Laravel/vendor/phar-io/manifest/src/xml/RequiresElement.php
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of PharIo\Manifest.
|
||||
*
|
||||
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace PharIo\Manifest;
|
||||
|
||||
class RequiresElement extends ManifestElement {
|
||||
public function getPHPElement() {
|
||||
return new PhpElement(
|
||||
$this->getChildByName('php')
|
||||
);
|
||||
}
|
||||
}
|
110
Laravel/vendor/phar-io/manifest/tests/ManifestDocumentMapperTest.php
vendored
Normal file
110
Laravel/vendor/phar-io/manifest/tests/ManifestDocumentMapperTest.php
vendored
Normal file
@@ -0,0 +1,110 @@
|
||||
<?php
|
||||
|
||||
namespace PharIo\Manifest;
|
||||
|
||||
/**
|
||||
* @covers \PharIo\Manifest\ManifestDocumentMapper
|
||||
*
|
||||
* @uses \PharIo\Manifest\ApplicationName
|
||||
* @uses \PharIo\Manifest\Author
|
||||
* @uses \PharIo\Manifest\AuthorCollection
|
||||
* @uses \PharIo\Manifest\AuthorCollectionIterator
|
||||
* @uses \PharIo\Manifest\AuthorElement
|
||||
* @uses \PharIo\Manifest\AuthorElementCollection
|
||||
* @uses \PharIo\Manifest\BundledComponent
|
||||
* @uses \PharIo\Manifest\BundledComponentCollection
|
||||
* @uses \PharIo\Manifest\BundledComponentCollectionIterator
|
||||
* @uses \PharIo\Manifest\BundlesElement
|
||||
* @uses \PharIo\Manifest\ComponentElement
|
||||
* @uses \PharIo\Manifest\ComponentElementCollection
|
||||
* @uses \PharIo\Manifest\ContainsElement
|
||||
* @uses \PharIo\Manifest\CopyrightElement
|
||||
* @uses \PharIo\Manifest\CopyrightInformation
|
||||
* @uses \PharIo\Manifest\ElementCollection
|
||||
* @uses \PharIo\Manifest\Email
|
||||
* @uses \PharIo\Manifest\ExtElement
|
||||
* @uses \PharIo\Manifest\ExtElementCollection
|
||||
* @uses \PharIo\Manifest\License
|
||||
* @uses \PharIo\Manifest\LicenseElement
|
||||
* @uses \PharIo\Manifest\Manifest
|
||||
* @uses \PharIo\Manifest\ManifestDocument
|
||||
* @uses \PharIo\Manifest\ManifestDocumentMapper
|
||||
* @uses \PharIo\Manifest\ManifestElement
|
||||
* @uses \PharIo\Manifest\ManifestLoader
|
||||
* @uses \PharIo\Manifest\PhpElement
|
||||
* @uses \PharIo\Manifest\PhpExtensionRequirement
|
||||
* @uses \PharIo\Manifest\PhpVersionRequirement
|
||||
* @uses \PharIo\Manifest\RequirementCollection
|
||||
* @uses \PharIo\Manifest\RequirementCollectionIterator
|
||||
* @uses \PharIo\Manifest\RequiresElement
|
||||
* @uses \PharIo\Manifest\Type
|
||||
* @uses \PharIo\Manifest\Url
|
||||
* @uses \PharIo\Version\Version
|
||||
* @uses \PharIo\Version\VersionConstraint
|
||||
*/
|
||||
class ManifestDocumentMapperTest extends \PHPUnit_Framework_TestCase {
|
||||
/**
|
||||
* @dataProvider dataProvider
|
||||
*
|
||||
* @param $expected
|
||||
*
|
||||
* @uses \PharIo\Manifest\Application
|
||||
* @uses \PharIo\Manifest\ApplicationName
|
||||
* @uses \PharIo\Manifest\Library
|
||||
* @uses \PharIo\Manifest\Extension
|
||||
* @uses \PharIo\Manifest\ExtensionElement
|
||||
*/
|
||||
public function testCanSerializeToString($expected) {
|
||||
$manifestDocument = ManifestDocument::fromFile($expected);
|
||||
$mapper = new ManifestDocumentMapper();
|
||||
|
||||
$this->assertInstanceOf(
|
||||
Manifest::class,
|
||||
$mapper->map($manifestDocument)
|
||||
);
|
||||
}
|
||||
|
||||
public function dataProvider() {
|
||||
return [
|
||||
'application' => [__DIR__ . '/_fixture/phpunit-5.6.5.xml'],
|
||||
'library' => [__DIR__ . '/_fixture/library.xml'],
|
||||
'extension' => [__DIR__ . '/_fixture/extension.xml']
|
||||
];
|
||||
}
|
||||
|
||||
public function testThrowsExceptionOnUnsupportedType() {
|
||||
$manifestDocument = ManifestDocument::fromFile(__DIR__ . '/_fixture/custom.xml');
|
||||
$mapper = new ManifestDocumentMapper();
|
||||
|
||||
$this->expectException(ManifestDocumentMapperException::class);
|
||||
$mapper->map($manifestDocument);
|
||||
}
|
||||
|
||||
public function testInvalidVersionInformationThrowsException() {
|
||||
$manifestDocument = ManifestDocument::fromFile(__DIR__ . '/_fixture/invalidversion.xml');
|
||||
$mapper = new ManifestDocumentMapper();
|
||||
|
||||
$this->expectException(ManifestDocumentMapperException::class);
|
||||
$mapper->map($manifestDocument);
|
||||
}
|
||||
|
||||
public function testInvalidVersionConstraintThrowsException() {
|
||||
$manifestDocument = ManifestDocument::fromFile(__DIR__ . '/_fixture/invalidversionconstraint.xml');
|
||||
$mapper = new ManifestDocumentMapper();
|
||||
|
||||
$this->expectException(ManifestDocumentMapperException::class);
|
||||
$mapper->map($manifestDocument);
|
||||
}
|
||||
|
||||
/**
|
||||
* @uses \PharIo\Manifest\ExtensionElement
|
||||
*/
|
||||
public function testInvalidCompatibleConstraintThrowsException() {
|
||||
$manifestDocument = ManifestDocument::fromFile(__DIR__ . '/_fixture/extension-invalidcompatible.xml');
|
||||
$mapper = new ManifestDocumentMapper();
|
||||
|
||||
$this->expectException(ManifestDocumentMapperException::class);
|
||||
$mapper->map($manifestDocument);
|
||||
}
|
||||
|
||||
}
|
83
Laravel/vendor/phar-io/manifest/tests/ManifestLoaderTest.php
vendored
Normal file
83
Laravel/vendor/phar-io/manifest/tests/ManifestLoaderTest.php
vendored
Normal file
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
|
||||
namespace PharIo\Manifest;
|
||||
|
||||
/**
|
||||
* @covers \PharIo\Manifest\ManifestLoader
|
||||
*
|
||||
* @uses \PharIo\Manifest\Author
|
||||
* @uses \PharIo\Manifest\AuthorCollection
|
||||
* @uses \PharIo\Manifest\AuthorCollectionIterator
|
||||
* @uses \PharIo\Manifest\AuthorElement
|
||||
* @uses \PharIo\Manifest\AuthorElementCollection
|
||||
* @uses \PharIo\Manifest\ApplicationName
|
||||
* @uses \PharIo\Manifest\BundledComponent
|
||||
* @uses \PharIo\Manifest\BundledComponentCollection
|
||||
* @uses \PharIo\Manifest\BundledComponentCollectionIterator
|
||||
* @uses \PharIo\Manifest\BundlesElement
|
||||
* @uses \PharIo\Manifest\ComponentElement
|
||||
* @uses \PharIo\Manifest\ComponentElementCollection
|
||||
* @uses \PharIo\Manifest\ContainsElement
|
||||
* @uses \PharIo\Manifest\CopyrightElement
|
||||
* @uses \PharIo\Manifest\CopyrightInformation
|
||||
* @uses \PharIo\Manifest\ElementCollection
|
||||
* @uses \PharIo\Manifest\Email
|
||||
* @uses \PharIo\Manifest\ExtElement
|
||||
* @uses \PharIo\Manifest\ExtElementCollection
|
||||
* @uses \PharIo\Manifest\License
|
||||
* @uses \PharIo\Manifest\LicenseElement
|
||||
* @uses \PharIo\Manifest\Manifest
|
||||
* @uses \PharIo\Manifest\ManifestDocument
|
||||
* @uses \PharIo\Manifest\ManifestDocumentMapper
|
||||
* @uses \PharIo\Manifest\ManifestElement
|
||||
* @uses \PharIo\Manifest\ManifestLoader
|
||||
* @uses \PharIo\Manifest\PhpElement
|
||||
* @uses \PharIo\Manifest\PhpExtensionRequirement
|
||||
* @uses \PharIo\Manifest\PhpVersionRequirement
|
||||
* @uses \PharIo\Manifest\RequirementCollection
|
||||
* @uses \PharIo\Manifest\RequirementCollectionIterator
|
||||
* @uses \PharIo\Manifest\RequiresElement
|
||||
* @uses \PharIo\Manifest\Type
|
||||
* @uses \PharIo\Manifest\Url
|
||||
* @uses \PharIo\Version\Version
|
||||
* @uses \PharIo\Version\VersionConstraint
|
||||
*/
|
||||
class ManifestLoaderTest extends \PHPUnit_Framework_TestCase {
|
||||
public function testCanBeLoadedFromFile() {
|
||||
$this->assertInstanceOf(
|
||||
Manifest::class,
|
||||
ManifestLoader::fromFile(__DIR__ . '/_fixture/library.xml')
|
||||
);
|
||||
}
|
||||
|
||||
public function testCanBeLoadedFromString() {
|
||||
$this->assertInstanceOf(
|
||||
Manifest::class,
|
||||
ManifestLoader::fromString(
|
||||
file_get_contents(__DIR__ . '/_fixture/library.xml')
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public function testCanBeLoadedFromPhar() {
|
||||
$this->assertInstanceOf(
|
||||
Manifest::class,
|
||||
ManifestLoader::fromPhar(__DIR__ . '/_fixture/test.phar')
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function testLoadingNonExistingFileThrowsException() {
|
||||
$this->expectException(ManifestLoaderException::class);
|
||||
ManifestLoader::fromFile('/not/existing');
|
||||
}
|
||||
|
||||
/**
|
||||
* @uses \PharIo\Manifest\ManifestDocumentLoadingException
|
||||
*/
|
||||
public function testLoadingInvalidXmlThrowsException() {
|
||||
$this->expectException(ManifestLoaderException::class);
|
||||
ManifestLoader::fromString('<?xml version="1.0" ?><broken>');
|
||||
}
|
||||
|
||||
}
|
114
Laravel/vendor/phar-io/manifest/tests/ManifestSerializerTest.php
vendored
Normal file
114
Laravel/vendor/phar-io/manifest/tests/ManifestSerializerTest.php
vendored
Normal file
@@ -0,0 +1,114 @@
|
||||
<?php
|
||||
|
||||
namespace PharIo\Manifest;
|
||||
|
||||
use PharIo\Version\Version;
|
||||
|
||||
/**
|
||||
* @covers \PharIo\Manifest\ManifestSerializer
|
||||
*
|
||||
* @uses \PharIo\Manifest\ApplicationName
|
||||
* @uses \PharIo\Manifest\Author
|
||||
* @uses \PharIo\Manifest\AuthorCollection
|
||||
* @uses \PharIo\Manifest\AuthorCollectionIterator
|
||||
* @uses \PharIo\Manifest\AuthorElement
|
||||
* @uses \PharIo\Manifest\AuthorElementCollection
|
||||
* @uses \PharIo\Manifest\BundledComponent
|
||||
* @uses \PharIo\Manifest\BundledComponentCollection
|
||||
* @uses \PharIo\Manifest\BundledComponentCollectionIterator
|
||||
* @uses \PharIo\Manifest\BundlesElement
|
||||
* @uses \PharIo\Manifest\ComponentElement
|
||||
* @uses \PharIo\Manifest\ComponentElementCollection
|
||||
* @uses \PharIo\Manifest\ContainsElement
|
||||
* @uses \PharIo\Manifest\CopyrightElement
|
||||
* @uses \PharIo\Manifest\CopyrightInformation
|
||||
* @uses \PharIo\Manifest\ElementCollection
|
||||
* @uses \PharIo\Manifest\Email
|
||||
* @uses \PharIo\Manifest\ExtElement
|
||||
* @uses \PharIo\Manifest\ExtElementCollection
|
||||
* @uses \PharIo\Manifest\License
|
||||
* @uses \PharIo\Manifest\LicenseElement
|
||||
* @uses \PharIo\Manifest\Manifest
|
||||
* @uses \PharIo\Manifest\ManifestDocument
|
||||
* @uses \PharIo\Manifest\ManifestDocumentMapper
|
||||
* @uses \PharIo\Manifest\ManifestElement
|
||||
* @uses \PharIo\Manifest\ManifestLoader
|
||||
* @uses \PharIo\Manifest\PhpElement
|
||||
* @uses \PharIo\Manifest\PhpExtensionRequirement
|
||||
* @uses \PharIo\Manifest\PhpVersionRequirement
|
||||
* @uses \PharIo\Manifest\RequirementCollection
|
||||
* @uses \PharIo\Manifest\RequirementCollectionIterator
|
||||
* @uses \PharIo\Manifest\RequiresElement
|
||||
* @uses \PharIo\Manifest\Type
|
||||
* @uses \PharIo\Manifest\Url
|
||||
* @uses \PharIo\Version\Version
|
||||
* @uses \PharIo\Version\VersionConstraint
|
||||
*/
|
||||
class ManifestSerializerTest extends \PHPUnit_Framework_TestCase {
|
||||
/**
|
||||
* @dataProvider dataProvider
|
||||
*
|
||||
* @param $expected
|
||||
*
|
||||
* @uses \PharIo\Manifest\Application
|
||||
* @uses \PharIo\Manifest\Library
|
||||
* @uses \PharIo\Manifest\Extension
|
||||
* @uses \PharIo\Manifest\ExtensionElement
|
||||
*/
|
||||
public function testCanSerializeToString($expected) {
|
||||
$manifest = ManifestLoader::fromString($expected);
|
||||
|
||||
$serializer = new ManifestSerializer();
|
||||
|
||||
$this->assertXmlStringEqualsXmlString(
|
||||
$expected,
|
||||
$serializer->serializeToString($manifest)
|
||||
);
|
||||
}
|
||||
|
||||
public function dataProvider() {
|
||||
return [
|
||||
'application' => [file_get_contents(__DIR__ . '/_fixture/phpunit-5.6.5.xml')],
|
||||
'library' => [file_get_contents(__DIR__ . '/_fixture/library.xml')],
|
||||
'extension' => [file_get_contents(__DIR__ . '/_fixture/extension.xml')]
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @uses \PharIo\Manifest\Library
|
||||
* @uses \PharIo\Manifest\ApplicationName
|
||||
*/
|
||||
public function testCanSerializeToFile() {
|
||||
$src = __DIR__ . '/_fixture/library.xml';
|
||||
$dest = '/tmp/' . uniqid('serializer', true);
|
||||
$manifest = ManifestLoader::fromFile($src);
|
||||
$serializer = new ManifestSerializer();
|
||||
$serializer->serializeToFile($manifest, $dest);
|
||||
$this->assertXmlFileEqualsXmlFile($src, $dest);
|
||||
unlink($dest);
|
||||
}
|
||||
|
||||
/**
|
||||
* @uses \PharIo\Manifest\ApplicationName
|
||||
*/
|
||||
public function testCanHandleUnknownType() {
|
||||
$type = $this->getMockForAbstractClass(Type::class);
|
||||
$manifest = new Manifest(
|
||||
new ApplicationName('testvendor/testname'),
|
||||
new Version('1.0.0'),
|
||||
$type,
|
||||
new CopyrightInformation(
|
||||
new AuthorCollection(),
|
||||
new License('bsd-3', new Url('https://some/uri'))
|
||||
),
|
||||
new RequirementCollection(),
|
||||
new BundledComponentCollection()
|
||||
);
|
||||
|
||||
$serializer = new ManifestSerializer();
|
||||
$this->assertXmlStringEqualsXmlFile(
|
||||
__DIR__ . '/_fixture/custom.xml',
|
||||
$serializer->serializeToString($manifest)
|
||||
);
|
||||
}
|
||||
}
|
10
Laravel/vendor/phar-io/manifest/tests/_fixture/custom.xml
vendored
Normal file
10
Laravel/vendor/phar-io/manifest/tests/_fixture/custom.xml
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<phar xmlns="https://phar.io/xml/manifest/1.0">
|
||||
<contains name="testvendor/testname" version="1.0.0" type="custom"/>
|
||||
<copyright>
|
||||
<license type="bsd-3" url="https://some/uri"/>
|
||||
</copyright>
|
||||
<requires>
|
||||
<php version="*"/>
|
||||
</requires>
|
||||
</phar>
|
13
Laravel/vendor/phar-io/manifest/tests/_fixture/extension-invalidcompatible.xml
vendored
Normal file
13
Laravel/vendor/phar-io/manifest/tests/_fixture/extension-invalidcompatible.xml
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<phar xmlns="https://phar.io/xml/manifest/1.0">
|
||||
<contains name="phpunit/phpunit-example-extension" version="1.0.0" type="extension">
|
||||
<extension for="phpunit/phpunit" compatible="invalid"/>
|
||||
</contains>
|
||||
<copyright>
|
||||
<author name="Sebastian Bergmann" email="sebastian@phpunit.de"/>
|
||||
<license type="BSD-3-Clause" url="https://github.com/sebastianbergmann/phpunit-example-extension/blob/master/LICENSE"/>
|
||||
</copyright>
|
||||
<requires>
|
||||
<php version="^7.0"/>
|
||||
</requires>
|
||||
</phar>
|
13
Laravel/vendor/phar-io/manifest/tests/_fixture/extension.xml
vendored
Normal file
13
Laravel/vendor/phar-io/manifest/tests/_fixture/extension.xml
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<phar xmlns="https://phar.io/xml/manifest/1.0">
|
||||
<contains name="phpunit/phpunit-example-extension" version="1.0.0" type="extension">
|
||||
<extension for="phpunit/phpunit" compatible="^5.7"/>
|
||||
</contains>
|
||||
<copyright>
|
||||
<author name="Sebastian Bergmann" email="sebastian@phpunit.de"/>
|
||||
<license type="BSD-3-Clause" url="https://github.com/sebastianbergmann/phpunit-example-extension/blob/master/LICENSE"/>
|
||||
</copyright>
|
||||
<requires>
|
||||
<php version="^7.0"/>
|
||||
</requires>
|
||||
</phar>
|
11
Laravel/vendor/phar-io/manifest/tests/_fixture/invalidversion.xml
vendored
Normal file
11
Laravel/vendor/phar-io/manifest/tests/_fixture/invalidversion.xml
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<phar xmlns="https://phar.io/xml/manifest/1.0">
|
||||
<contains name="some/library" version="abc" type="library" />
|
||||
<copyright>
|
||||
<author name="Reiner Zufall" email="reiner@zufall.de"/>
|
||||
<license type="BSD-3-Clause" url="https://domain.tld/LICENSE"/>
|
||||
</copyright>
|
||||
<requires>
|
||||
<php version="7.0"/>
|
||||
</requires>
|
||||
</phar>
|
11
Laravel/vendor/phar-io/manifest/tests/_fixture/invalidversionconstraint.xml
vendored
Normal file
11
Laravel/vendor/phar-io/manifest/tests/_fixture/invalidversionconstraint.xml
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<phar xmlns="https://phar.io/xml/manifest/1.0">
|
||||
<contains name="some/library" version="1.0.0" type="library" />
|
||||
<copyright>
|
||||
<author name="Reiner Zufall" email="reiner@zufall.de"/>
|
||||
<license type="BSD-3-Clause" url="https://domain.tld/LICENSE"/>
|
||||
</copyright>
|
||||
<requires>
|
||||
<php version="invalid"/>
|
||||
</requires>
|
||||
</phar>
|
11
Laravel/vendor/phar-io/manifest/tests/_fixture/library.xml
vendored
Normal file
11
Laravel/vendor/phar-io/manifest/tests/_fixture/library.xml
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<phar xmlns="https://phar.io/xml/manifest/1.0">
|
||||
<contains name="some/library" version="1.0.0" type="library" />
|
||||
<copyright>
|
||||
<author name="Reiner Zufall" email="reiner@zufall.de"/>
|
||||
<license type="BSD-3-Clause" url="https://domain.tld/LICENSE"/>
|
||||
</copyright>
|
||||
<requires>
|
||||
<php version="7.0"/>
|
||||
</requires>
|
||||
</phar>
|
11
Laravel/vendor/phar-io/manifest/tests/_fixture/manifest.xml
vendored
Normal file
11
Laravel/vendor/phar-io/manifest/tests/_fixture/manifest.xml
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<phar xmlns="https://phar.io/xml/manifest/1.0">
|
||||
<contains name="some/library" version="1.0.0" type="library" />
|
||||
<copyright>
|
||||
<author name="Reiner Zufall" email="reiner@zufall.de"/>
|
||||
<license type="BSD-3-Clause" url="https://domain.tld/LICENSE"/>
|
||||
</copyright>
|
||||
<requires>
|
||||
<php version="7.0"/>
|
||||
</requires>
|
||||
</phar>
|
46
Laravel/vendor/phar-io/manifest/tests/_fixture/phpunit-5.6.5.xml
vendored
Normal file
46
Laravel/vendor/phar-io/manifest/tests/_fixture/phpunit-5.6.5.xml
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<phar xmlns="https://phar.io/xml/manifest/1.0">
|
||||
<contains name="phpunit/phpunit" version="5.6.5" type="application"/>
|
||||
<copyright>
|
||||
<author name="Sebastian Bergmann" email="sebastian@phpunit.de"/>
|
||||
<license type="BSD-3-Clause" url="https://github.com/sebastianbergmann/phpunit/blob/master/LICENSE"/>
|
||||
</copyright>
|
||||
<requires>
|
||||
<!-- constraint on next line should be ^5.6 || ^7.0 -->
|
||||
<php version="^7.0">
|
||||
<ext name="dom"/>
|
||||
<ext name="json"/>
|
||||
<ext name="mbstring"/>
|
||||
<ext name="xml"/>
|
||||
<ext name="libxml"/>
|
||||
</php>
|
||||
</requires>
|
||||
<bundles>
|
||||
<component name="doctrine/instantiator" version="1.0.5"/>
|
||||
<component name="myclabs/deep-copy" version="1.5.5"/>
|
||||
<component name="phpdocumentor/reflection-common" version="1.0"/>
|
||||
<component name="phpdocumentor/reflection-docblock" version="3.1.1"/>
|
||||
<component name="phpdocumentor/type-resolver" version="0.2"/>
|
||||
<component name="phpspec/prophecy" version="v1.6.2"/>
|
||||
<component name="phpunit/dbunit" version="2.0.2"/>
|
||||
<component name="phpunit/php-code-coverage" version="4.0.2"/>
|
||||
<component name="phpunit/php-file-iterator" version="1.4.1"/>
|
||||
<component name="phpunit/php-invoker" version="1.1.4"/>
|
||||
<component name="phpunit/php-text-template" version="1.2.1"/>
|
||||
<component name="phpunit/php-timer" version="1.0.8"/>
|
||||
<component name="phpunit/php-token-stream" version="1.4.9"/>
|
||||
<component name="phpunit/phpunit-mock-objects" version="3.4.1"/>
|
||||
<component name="sebastian/code-unit-reverse-lookup" version="1.0.0"/>
|
||||
<component name="sebastian/comparator" version="1.2.2"/>
|
||||
<component name="sebastian/diff" version="1.4.1"/>
|
||||
<component name="sebastian/environment" version="1.3.8"/>
|
||||
<component name="sebastian/exporter" version="2.0.0"/>
|
||||
<component name="sebastian/global-state" version="1.1.1"/>
|
||||
<component name="sebastian/object-enumerator" version="2.0.0"/>
|
||||
<component name="sebastian/recursion-context" version="2.0.0"/>
|
||||
<component name="sebastian/resource-operations" version="1.0.0"/>
|
||||
<component name="sebastian/version" version="2.0.0"/>
|
||||
<component name="symfony/yaml" version="v3.1.7"/>
|
||||
<component name="webmozart/assert" version="1.1.0"/>
|
||||
</bundles>
|
||||
</phar>
|
BIN
Laravel/vendor/phar-io/manifest/tests/_fixture/test.phar
vendored
Normal file
BIN
Laravel/vendor/phar-io/manifest/tests/_fixture/test.phar
vendored
Normal file
Binary file not shown.
19
Laravel/vendor/phar-io/manifest/tests/exceptions/ManifestDocumentLoadingExceptionTest.php
vendored
Normal file
19
Laravel/vendor/phar-io/manifest/tests/exceptions/ManifestDocumentLoadingExceptionTest.php
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace PharIo\Manifest;
|
||||
|
||||
use DOMDocument;
|
||||
use LibXMLError;
|
||||
|
||||
class ManifestDocumentLoadingExceptionTest extends \PHPUnit_Framework_TestCase {
|
||||
public function testXMLErrorsCanBeRetrieved() {
|
||||
$dom = new DOMDocument();
|
||||
$prev = libxml_use_internal_errors(true);
|
||||
$dom->loadXML('<?xml version="1.0" ?><broken>');
|
||||
$exception = new ManifestDocumentLoadingException(libxml_get_errors());
|
||||
libxml_use_internal_errors($prev);
|
||||
|
||||
$this->assertContainsOnlyInstancesOf(LibXMLError::class, $exception->getLibxmlErrors());
|
||||
}
|
||||
|
||||
}
|
48
Laravel/vendor/phar-io/manifest/tests/values/ApplicationNameTest.php
vendored
Normal file
48
Laravel/vendor/phar-io/manifest/tests/values/ApplicationNameTest.php
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php declare(strict_types = 1);
|
||||
namespace PharIo\Manifest;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class ApplicationNameTest extends TestCase {
|
||||
|
||||
public function testCanBeCreatedWithValidName() {
|
||||
$this->assertInstanceOf(
|
||||
ApplicationName::class,
|
||||
new ApplicationName('foo/bar')
|
||||
);
|
||||
}
|
||||
|
||||
public function testUsingInvalidFormatForNameThrowsException() {
|
||||
$this->expectException(InvalidApplicationNameException::class);
|
||||
$this->expectExceptionCode(InvalidApplicationNameException::InvalidFormat);
|
||||
new ApplicationName('foo');
|
||||
}
|
||||
|
||||
public function testUsingWrongTypeForNameThrowsException() {
|
||||
$this->expectException(InvalidApplicationNameException::class);
|
||||
$this->expectExceptionCode(InvalidApplicationNameException::NotAString);
|
||||
new ApplicationName(123);
|
||||
}
|
||||
|
||||
public function testReturnsTrueForEqualNamesWhenCompared() {
|
||||
$app = new ApplicationName('foo/bar');
|
||||
$this->assertTrue(
|
||||
$app->isEqual($app)
|
||||
);
|
||||
}
|
||||
|
||||
public function testReturnsFalseForNonEqualNamesWhenCompared() {
|
||||
$app1 = new ApplicationName('foo/bar');
|
||||
$app2 = new ApplicationName('foo/foo');
|
||||
$this->assertFalse(
|
||||
$app1->isEqual($app2)
|
||||
);
|
||||
}
|
||||
|
||||
public function testCanBeConvertedToString() {
|
||||
$this->assertEquals(
|
||||
'foo/bar',
|
||||
new ApplicationName('foo/bar')
|
||||
);
|
||||
}
|
||||
}
|
44
Laravel/vendor/phar-io/manifest/tests/values/ApplicationTest.php
vendored
Normal file
44
Laravel/vendor/phar-io/manifest/tests/values/ApplicationTest.php
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of PharIo\Manifest.
|
||||
*
|
||||
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace PharIo\Manifest;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* @covers PharIo\Manifest\Application
|
||||
* @covers PharIo\Manifest\Type
|
||||
*/
|
||||
class ApplicationTest extends TestCase {
|
||||
/**
|
||||
* @var Application
|
||||
*/
|
||||
private $type;
|
||||
|
||||
protected function setUp() {
|
||||
$this->type = Type::application();
|
||||
}
|
||||
|
||||
public function testCanBeCreated() {
|
||||
$this->assertInstanceOf(Application::class, $this->type);
|
||||
}
|
||||
|
||||
public function testIsApplication() {
|
||||
$this->assertTrue($this->type->isApplication());
|
||||
}
|
||||
|
||||
public function testIsNotLibrary() {
|
||||
$this->assertFalse($this->type->isLibrary());
|
||||
}
|
||||
|
||||
public function testIsNotExtension() {
|
||||
$this->assertFalse($this->type->isExtension());
|
||||
}
|
||||
}
|
62
Laravel/vendor/phar-io/manifest/tests/values/AuthorCollectionTest.php
vendored
Normal file
62
Laravel/vendor/phar-io/manifest/tests/values/AuthorCollectionTest.php
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of PharIo\Manifest.
|
||||
*
|
||||
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace PharIo\Manifest;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* @covers \PharIo\Manifest\AuthorCollection
|
||||
* @covers \PharIo\Manifest\AuthorCollectionIterator
|
||||
*
|
||||
* @uses \PharIo\Manifest\Author
|
||||
* @uses \PharIo\Manifest\Email
|
||||
*/
|
||||
class AuthorCollectionTest extends TestCase {
|
||||
/**
|
||||
* @var AuthorCollection
|
||||
*/
|
||||
private $collection;
|
||||
|
||||
/**
|
||||
* @var Author
|
||||
*/
|
||||
private $item;
|
||||
|
||||
protected function setUp() {
|
||||
$this->collection = new AuthorCollection;
|
||||
$this->item = new Author('Joe Developer', new Email('user@example.com'));
|
||||
}
|
||||
|
||||
public function testCanBeCreated() {
|
||||
$this->assertInstanceOf(AuthorCollection::class, $this->collection);
|
||||
}
|
||||
|
||||
public function testCanBeCounted() {
|
||||
$this->collection->add($this->item);
|
||||
|
||||
$this->assertCount(1, $this->collection);
|
||||
}
|
||||
|
||||
public function testCanBeIterated() {
|
||||
$this->collection->add(
|
||||
new Author('Dummy First', new Email('dummy@example.com'))
|
||||
);
|
||||
$this->collection->add($this->item);
|
||||
$this->assertContains($this->item, $this->collection);
|
||||
}
|
||||
|
||||
public function testKeyPositionCanBeRetreived() {
|
||||
$this->collection->add($this->item);
|
||||
foreach($this->collection as $key => $item) {
|
||||
$this->assertEquals(0, $key);
|
||||
}
|
||||
}
|
||||
}
|
45
Laravel/vendor/phar-io/manifest/tests/values/AuthorTest.php
vendored
Normal file
45
Laravel/vendor/phar-io/manifest/tests/values/AuthorTest.php
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of PharIo\Manifest.
|
||||
*
|
||||
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace PharIo\Manifest;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* @covers PharIo\Manifest\Author
|
||||
*
|
||||
* @uses PharIo\Manifest\Email
|
||||
*/
|
||||
class AuthorTest extends TestCase {
|
||||
/**
|
||||
* @var Author
|
||||
*/
|
||||
private $author;
|
||||
|
||||
protected function setUp() {
|
||||
$this->author = new Author('Joe Developer', new Email('user@example.com'));
|
||||
}
|
||||
|
||||
public function testCanBeCreated() {
|
||||
$this->assertInstanceOf(Author::class, $this->author);
|
||||
}
|
||||
|
||||
public function testNameCanBeRetrieved() {
|
||||
$this->assertEquals('Joe Developer', $this->author->getName());
|
||||
}
|
||||
|
||||
public function testEmailCanBeRetrieved() {
|
||||
$this->assertEquals('user@example.com', $this->author->getEmail());
|
||||
}
|
||||
|
||||
public function testCanBeUsedAsString() {
|
||||
$this->assertEquals('Joe Developer <user@example.com>', $this->author);
|
||||
}
|
||||
}
|
63
Laravel/vendor/phar-io/manifest/tests/values/BundledComponentCollectionTest.php
vendored
Normal file
63
Laravel/vendor/phar-io/manifest/tests/values/BundledComponentCollectionTest.php
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of PharIo\Manifest.
|
||||
*
|
||||
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace PharIo\Manifest;
|
||||
|
||||
use PharIo\Version\Version;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* @covers \PharIo\Manifest\BundledComponentCollection
|
||||
* @covers \PharIo\Manifest\BundledComponentCollectionIterator
|
||||
*
|
||||
* @uses \PharIo\Manifest\BundledComponent
|
||||
* @uses \PharIo\Version\Version
|
||||
*/
|
||||
class BundledComponentCollectionTest extends TestCase {
|
||||
/**
|
||||
* @var BundledComponentCollection
|
||||
*/
|
||||
private $collection;
|
||||
|
||||
/**
|
||||
* @var BundledComponent
|
||||
*/
|
||||
private $item;
|
||||
|
||||
protected function setUp() {
|
||||
$this->collection = new BundledComponentCollection;
|
||||
$this->item = new BundledComponent('phpunit/php-code-coverage', new Version('4.0.2'));
|
||||
}
|
||||
|
||||
public function testCanBeCreated() {
|
||||
$this->assertInstanceOf(BundledComponentCollection::class, $this->collection);
|
||||
}
|
||||
|
||||
public function testCanBeCounted() {
|
||||
$this->collection->add($this->item);
|
||||
|
||||
$this->assertCount(1, $this->collection);
|
||||
}
|
||||
|
||||
public function testCanBeIterated() {
|
||||
$this->collection->add($this->createMock(BundledComponent::class));
|
||||
$this->collection->add($this->item);
|
||||
|
||||
$this->assertContains($this->item, $this->collection);
|
||||
}
|
||||
|
||||
public function testKeyPositionCanBeRetreived() {
|
||||
$this->collection->add($this->item);
|
||||
foreach($this->collection as $key => $item) {
|
||||
$this->assertEquals(0, $key);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
42
Laravel/vendor/phar-io/manifest/tests/values/BundledComponentTest.php
vendored
Normal file
42
Laravel/vendor/phar-io/manifest/tests/values/BundledComponentTest.php
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of PharIo\Manifest.
|
||||
*
|
||||
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace PharIo\Manifest;
|
||||
|
||||
use PharIo\Version\Version;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* @covers PharIo\Manifest\BundledComponent
|
||||
*
|
||||
* @uses \PharIo\Version\Version
|
||||
*/
|
||||
class BundledComponentTest extends TestCase {
|
||||
/**
|
||||
* @var BundledComponent
|
||||
*/
|
||||
private $bundledComponent;
|
||||
|
||||
protected function setUp() {
|
||||
$this->bundledComponent = new BundledComponent('phpunit/php-code-coverage', new Version('4.0.2'));
|
||||
}
|
||||
|
||||
public function testCanBeCreated() {
|
||||
$this->assertInstanceOf(BundledComponent::class, $this->bundledComponent);
|
||||
}
|
||||
|
||||
public function testNameCanBeRetrieved() {
|
||||
$this->assertEquals('phpunit/php-code-coverage', $this->bundledComponent->getName());
|
||||
}
|
||||
|
||||
public function testVersionCanBeRetrieved() {
|
||||
$this->assertEquals('4.0.2', $this->bundledComponent->getVersion()->getVersionString());
|
||||
}
|
||||
}
|
62
Laravel/vendor/phar-io/manifest/tests/values/CopyrightInformationTest.php
vendored
Normal file
62
Laravel/vendor/phar-io/manifest/tests/values/CopyrightInformationTest.php
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of PharIo\Manifest.
|
||||
*
|
||||
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace PharIo\Manifest;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* @covers PharIo\Manifest\CopyrightInformation
|
||||
*
|
||||
* @uses PharIo\Manifest\AuthorCollection
|
||||
* @uses PharIo\Manifest\AuthorCollectionIterator
|
||||
* @uses PharIo\Manifest\Author
|
||||
* @uses PharIo\Manifest\Email
|
||||
* @uses PharIo\Manifest\License
|
||||
* @uses PharIo\Manifest\Url
|
||||
*/
|
||||
class CopyrightInformationTest extends TestCase {
|
||||
/**
|
||||
* @var CopyrightInformation
|
||||
*/
|
||||
private $copyrightInformation;
|
||||
|
||||
/**
|
||||
* @var Author
|
||||
*/
|
||||
private $author;
|
||||
|
||||
/**
|
||||
* @var License
|
||||
*/
|
||||
private $license;
|
||||
|
||||
protected function setUp() {
|
||||
$this->author = new Author('Joe Developer', new Email('user@example.com'));
|
||||
$this->license = new License('BSD-3-Clause', new Url('https://github.com/sebastianbergmann/phpunit/blob/master/LICENSE'));
|
||||
|
||||
$authors = new AuthorCollection;
|
||||
$authors->add($this->author);
|
||||
|
||||
$this->copyrightInformation = new CopyrightInformation($authors, $this->license);
|
||||
}
|
||||
|
||||
public function testCanBeCreated() {
|
||||
$this->assertInstanceOf(CopyrightInformation::class, $this->copyrightInformation);
|
||||
}
|
||||
|
||||
public function testAuthorsCanBeRetrieved() {
|
||||
$this->assertContains($this->author, $this->copyrightInformation->getAuthors());
|
||||
}
|
||||
|
||||
public function testLicenseCanBeRetrieved() {
|
||||
$this->assertEquals($this->license, $this->copyrightInformation->getLicense());
|
||||
}
|
||||
}
|
35
Laravel/vendor/phar-io/manifest/tests/values/EmailTest.php
vendored
Normal file
35
Laravel/vendor/phar-io/manifest/tests/values/EmailTest.php
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of PharIo\Manifest.
|
||||
*
|
||||
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace PharIo\Manifest;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* @covers PharIo\Manifest\Email
|
||||
*/
|
||||
class EmailTest extends TestCase {
|
||||
public function testCanBeCreatedForValidEmail() {
|
||||
$this->assertInstanceOf(Email::class, new Email('user@example.com'));
|
||||
}
|
||||
|
||||
public function testCanBeUsedAsString() {
|
||||
$this->assertEquals('user@example.com', new Email('user@example.com'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers PharIo\Manifest\InvalidEmailException
|
||||
*/
|
||||
public function testCannotBeCreatedForInvalidEmail() {
|
||||
$this->expectException(InvalidEmailException::class);
|
||||
|
||||
new Email('invalid');
|
||||
}
|
||||
}
|
109
Laravel/vendor/phar-io/manifest/tests/values/ExtensionTest.php
vendored
Normal file
109
Laravel/vendor/phar-io/manifest/tests/values/ExtensionTest.php
vendored
Normal file
@@ -0,0 +1,109 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of PharIo\Manifest.
|
||||
*
|
||||
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace PharIo\Manifest;
|
||||
|
||||
use PharIo\Version\AnyVersionConstraint;
|
||||
use PharIo\Version\Version;
|
||||
use PharIo\Version\VersionConstraint;
|
||||
use PharIo\Version\VersionConstraintParser;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* @covers \PharIo\Manifest\Extension
|
||||
* @covers \PharIo\Manifest\Type
|
||||
*
|
||||
* @uses \PharIo\Version\VersionConstraint
|
||||
* @uses \PharIo\Manifest\ApplicationName
|
||||
*/
|
||||
class ExtensionTest extends TestCase {
|
||||
/**
|
||||
* @var Extension
|
||||
*/
|
||||
private $type;
|
||||
|
||||
/**
|
||||
* @var ApplicationName|\PHPUnit_Framework_MockObject_MockObject
|
||||
*/
|
||||
private $name;
|
||||
|
||||
protected function setUp() {
|
||||
$this->name = $this->createMock(ApplicationName::class);
|
||||
$this->type = Type::extension($this->name, new AnyVersionConstraint);
|
||||
}
|
||||
|
||||
public function testCanBeCreated() {
|
||||
$this->assertInstanceOf(Extension::class, $this->type);
|
||||
}
|
||||
|
||||
public function testIsNotApplication() {
|
||||
$this->assertFalse($this->type->isApplication());
|
||||
}
|
||||
|
||||
public function testIsNotLibrary() {
|
||||
$this->assertFalse($this->type->isLibrary());
|
||||
}
|
||||
|
||||
public function testIsExtension() {
|
||||
$this->assertTrue($this->type->isExtension());
|
||||
}
|
||||
|
||||
public function testApplicationCanBeRetrieved()
|
||||
{
|
||||
$this->assertInstanceOf(ApplicationName::class, $this->type->getApplicationName());
|
||||
}
|
||||
|
||||
public function testVersionConstraintCanBeRetrieved() {
|
||||
$this->assertInstanceOf(
|
||||
VersionConstraint::class,
|
||||
$this->type->getVersionConstraint()
|
||||
);
|
||||
}
|
||||
|
||||
public function testApplicationCanBeQueried()
|
||||
{
|
||||
$this->name->method('isEqual')->willReturn(true);
|
||||
$this->assertTrue(
|
||||
$this->type->isExtensionFor($this->createMock(ApplicationName::class))
|
||||
);
|
||||
}
|
||||
|
||||
public function testCompatibleWithReturnsTrueForMatchingVersionConstraintAndApplicaiton() {
|
||||
$app = new ApplicationName('foo/bar');
|
||||
$extension = Type::extension($app, (new VersionConstraintParser)->parse('^1.0'));
|
||||
$version = new Version('1.0.0');
|
||||
|
||||
$this->assertTrue(
|
||||
$extension->isCompatibleWith($app, $version)
|
||||
);
|
||||
}
|
||||
|
||||
public function testCompatibleWithReturnsFalseForNotMatchingVersionConstraint() {
|
||||
$app = new ApplicationName('foo/bar');
|
||||
$extension = Type::extension($app, (new VersionConstraintParser)->parse('^1.0'));
|
||||
$version = new Version('2.0.0');
|
||||
|
||||
$this->assertFalse(
|
||||
$extension->isCompatibleWith($app, $version)
|
||||
);
|
||||
}
|
||||
|
||||
public function testCompatibleWithReturnsFalseForNotMatchingApplication() {
|
||||
$app1 = new ApplicationName('foo/bar');
|
||||
$app2 = new ApplicationName('foo/foo');
|
||||
$extension = Type::extension($app1, (new VersionConstraintParser)->parse('^1.0'));
|
||||
$version = new Version('1.0.0');
|
||||
|
||||
$this->assertFalse(
|
||||
$extension->isCompatibleWith($app2, $version)
|
||||
);
|
||||
}
|
||||
|
||||
}
|
44
Laravel/vendor/phar-io/manifest/tests/values/LibraryTest.php
vendored
Normal file
44
Laravel/vendor/phar-io/manifest/tests/values/LibraryTest.php
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of PharIo\Manifest.
|
||||
*
|
||||
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace PharIo\Manifest;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* @covers PharIo\Manifest\Library
|
||||
* @covers PharIo\Manifest\Type
|
||||
*/
|
||||
class LibraryTest extends TestCase {
|
||||
/**
|
||||
* @var Library
|
||||
*/
|
||||
private $type;
|
||||
|
||||
protected function setUp() {
|
||||
$this->type = Type::library();
|
||||
}
|
||||
|
||||
public function testCanBeCreated() {
|
||||
$this->assertInstanceOf(Library::class, $this->type);
|
||||
}
|
||||
|
||||
public function testIsNotApplication() {
|
||||
$this->assertFalse($this->type->isApplication());
|
||||
}
|
||||
|
||||
public function testIsLibrary() {
|
||||
$this->assertTrue($this->type->isLibrary());
|
||||
}
|
||||
|
||||
public function testIsNotExtension() {
|
||||
$this->assertFalse($this->type->isExtension());
|
||||
}
|
||||
}
|
41
Laravel/vendor/phar-io/manifest/tests/values/LicenseTest.php
vendored
Normal file
41
Laravel/vendor/phar-io/manifest/tests/values/LicenseTest.php
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of PharIo\Manifest.
|
||||
*
|
||||
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace PharIo\Manifest;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* @covers PharIo\Manifest\License
|
||||
*
|
||||
* @uses PharIo\Manifest\Url
|
||||
*/
|
||||
class LicenseTest extends TestCase {
|
||||
/**
|
||||
* @var License
|
||||
*/
|
||||
private $license;
|
||||
|
||||
protected function setUp() {
|
||||
$this->license = new License('BSD-3-Clause', new Url('https://github.com/sebastianbergmann/phpunit/blob/master/LICENSE'));
|
||||
}
|
||||
|
||||
public function testCanBeCreated() {
|
||||
$this->assertInstanceOf(License::class, $this->license);
|
||||
}
|
||||
|
||||
public function testNameCanBeRetrieved() {
|
||||
$this->assertEquals('BSD-3-Clause', $this->license->getName());
|
||||
}
|
||||
|
||||
public function testUrlCanBeRetrieved() {
|
||||
$this->assertEquals('https://github.com/sebastianbergmann/phpunit/blob/master/LICENSE', $this->license->getUrl());
|
||||
}
|
||||
}
|
187
Laravel/vendor/phar-io/manifest/tests/values/ManifestTest.php
vendored
Normal file
187
Laravel/vendor/phar-io/manifest/tests/values/ManifestTest.php
vendored
Normal file
@@ -0,0 +1,187 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of PharIo\Manifest.
|
||||
*
|
||||
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace PharIo\Manifest;
|
||||
|
||||
use PharIo\Version\Version;
|
||||
use PharIo\Version\AnyVersionConstraint;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* @covers \PharIo\Manifest\Manifest
|
||||
*
|
||||
* @uses \PharIo\Manifest\ApplicationName
|
||||
* @uses \PharIo\Manifest\Author
|
||||
* @uses \PharIo\Manifest\AuthorCollection
|
||||
* @uses \PharIo\Manifest\BundledComponent
|
||||
* @uses \PharIo\Manifest\BundledComponentCollection
|
||||
* @uses \PharIo\Manifest\CopyrightInformation
|
||||
* @uses \PharIo\Manifest\Email
|
||||
* @uses \PharIo\Manifest\License
|
||||
* @uses \PharIo\Manifest\RequirementCollection
|
||||
* @uses \PharIo\Manifest\PhpVersionRequirement
|
||||
* @uses \PharIo\Manifest\Type
|
||||
* @uses \PharIo\Manifest\Application
|
||||
* @uses \PharIo\Manifest\Url
|
||||
* @uses \PharIo\Version\Version
|
||||
* @uses \PharIo\Version\VersionConstraint
|
||||
*/
|
||||
class ManifestTest extends TestCase {
|
||||
/**
|
||||
* @var ApplicationName
|
||||
*/
|
||||
private $name;
|
||||
|
||||
/**
|
||||
* @var Version
|
||||
*/
|
||||
private $version;
|
||||
|
||||
/**
|
||||
* @var Type
|
||||
*/
|
||||
private $type;
|
||||
|
||||
/**
|
||||
* @var CopyrightInformation
|
||||
*/
|
||||
private $copyrightInformation;
|
||||
|
||||
/**
|
||||
* @var RequirementCollection
|
||||
*/
|
||||
private $requirements;
|
||||
|
||||
/**
|
||||
* @var BundledComponentCollection
|
||||
*/
|
||||
private $bundledComponents;
|
||||
|
||||
/**
|
||||
* @var Manifest
|
||||
*/
|
||||
private $manifest;
|
||||
|
||||
protected function setUp() {
|
||||
$this->version = new Version('5.6.5');
|
||||
|
||||
$this->type = Type::application();
|
||||
|
||||
$author = new Author('Joe Developer', new Email('user@example.com'));
|
||||
$license = new License('BSD-3-Clause', new Url('https://github.com/sebastianbergmann/phpunit/blob/master/LICENSE'));
|
||||
|
||||
$authors = new AuthorCollection;
|
||||
$authors->add($author);
|
||||
|
||||
$this->copyrightInformation = new CopyrightInformation($authors, $license);
|
||||
|
||||
$this->requirements = new RequirementCollection;
|
||||
$this->requirements->add(new PhpVersionRequirement(new AnyVersionConstraint));
|
||||
|
||||
$this->bundledComponents = new BundledComponentCollection;
|
||||
$this->bundledComponents->add(new BundledComponent('phpunit/php-code-coverage', new Version('4.0.2')));
|
||||
|
||||
$this->name = new ApplicationName('phpunit/phpunit');
|
||||
|
||||
$this->manifest = new Manifest(
|
||||
$this->name,
|
||||
$this->version,
|
||||
$this->type,
|
||||
$this->copyrightInformation,
|
||||
$this->requirements,
|
||||
$this->bundledComponents
|
||||
);
|
||||
}
|
||||
|
||||
public function testCanBeCreated() {
|
||||
$this->assertInstanceOf(Manifest::class, $this->manifest);
|
||||
}
|
||||
|
||||
public function testNameCanBeRetrieved() {
|
||||
$this->assertEquals($this->name, $this->manifest->getName());
|
||||
}
|
||||
|
||||
public function testVersionCanBeRetrieved() {
|
||||
$this->assertEquals($this->version, $this->manifest->getVersion());
|
||||
}
|
||||
|
||||
public function testTypeCanBeRetrieved() {
|
||||
$this->assertEquals($this->type, $this->manifest->getType());
|
||||
}
|
||||
|
||||
public function testTypeCanBeQueried() {
|
||||
$this->assertTrue($this->manifest->isApplication());
|
||||
$this->assertFalse($this->manifest->isLibrary());
|
||||
$this->assertFalse($this->manifest->isExtension());
|
||||
}
|
||||
|
||||
public function testCopyrightInformationCanBeRetrieved() {
|
||||
$this->assertEquals($this->copyrightInformation, $this->manifest->getCopyrightInformation());
|
||||
}
|
||||
|
||||
public function testRequirementsCanBeRetrieved() {
|
||||
$this->assertEquals($this->requirements, $this->manifest->getRequirements());
|
||||
}
|
||||
|
||||
public function testBundledComponentsCanBeRetrieved() {
|
||||
$this->assertEquals($this->bundledComponents, $this->manifest->getBundledComponents());
|
||||
}
|
||||
|
||||
/**
|
||||
* @uses \PharIo\Manifest\Extension
|
||||
*/
|
||||
public function testExtendedApplicationCanBeQueriedForExtension()
|
||||
{
|
||||
$appName = new ApplicationName('foo/bar');
|
||||
$manifest = new Manifest(
|
||||
new ApplicationName('foo/foo'),
|
||||
new Version('1.0.0'),
|
||||
Type::extension($appName, new AnyVersionConstraint),
|
||||
$this->copyrightInformation,
|
||||
new RequirementCollection,
|
||||
new BundledComponentCollection
|
||||
);
|
||||
|
||||
$this->assertTrue($manifest->isExtensionFor($appName));
|
||||
}
|
||||
|
||||
public function testNonExtensionReturnsFalseWhenQueriesForExtension() {
|
||||
$appName = new ApplicationName('foo/bar');
|
||||
$manifest = new Manifest(
|
||||
new ApplicationName('foo/foo'),
|
||||
new Version('1.0.0'),
|
||||
Type::library(),
|
||||
$this->copyrightInformation,
|
||||
new RequirementCollection,
|
||||
new BundledComponentCollection
|
||||
);
|
||||
|
||||
$this->assertFalse($manifest->isExtensionFor($appName));
|
||||
}
|
||||
|
||||
/**
|
||||
* @uses \PharIo\Manifest\Extension
|
||||
*/
|
||||
public function testExtendedApplicationCanBeQueriedForExtensionWithVersion()
|
||||
{
|
||||
$appName = new ApplicationName('foo/bar');
|
||||
$manifest = new Manifest(
|
||||
new ApplicationName('foo/foo'),
|
||||
new Version('1.0.0'),
|
||||
Type::extension($appName, new AnyVersionConstraint),
|
||||
$this->copyrightInformation,
|
||||
new RequirementCollection,
|
||||
new BundledComponentCollection
|
||||
);
|
||||
|
||||
$this->assertTrue($manifest->isExtensionFor($appName, new Version('1.2.3')));
|
||||
}
|
||||
|
||||
}
|
26
Laravel/vendor/phar-io/manifest/tests/values/PhpExtensionRequirementTest.php
vendored
Normal file
26
Laravel/vendor/phar-io/manifest/tests/values/PhpExtensionRequirementTest.php
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of PharIo\Manifest.
|
||||
*
|
||||
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace PharIo\Manifest;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* @covers PharIo\Manifest\PhpExtensionRequirement
|
||||
*/
|
||||
class PhpExtensionRequirementTest extends TestCase {
|
||||
public function testCanBeCreated() {
|
||||
$this->assertInstanceOf(PhpExtensionRequirement::class, new PhpExtensionRequirement('dom'));
|
||||
}
|
||||
|
||||
public function testCanBeUsedAsString() {
|
||||
$this->assertEquals('dom', new PhpExtensionRequirement('dom'));
|
||||
}
|
||||
}
|
38
Laravel/vendor/phar-io/manifest/tests/values/PhpVersionRequirementTest.php
vendored
Normal file
38
Laravel/vendor/phar-io/manifest/tests/values/PhpVersionRequirementTest.php
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of PharIo\Manifest.
|
||||
*
|
||||
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace PharIo\Manifest;
|
||||
|
||||
use PharIo\Version\ExactVersionConstraint;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* @covers PharIo\Manifest\PhpVersionRequirement
|
||||
*
|
||||
* @uses \PharIo\Version\VersionConstraint
|
||||
*/
|
||||
class PhpVersionRequirementTest extends TestCase {
|
||||
/**
|
||||
* @var PhpVersionRequirement
|
||||
*/
|
||||
private $requirement;
|
||||
|
||||
protected function setUp() {
|
||||
$this->requirement = new PhpVersionRequirement(new ExactVersionConstraint('7.1.0'));
|
||||
}
|
||||
|
||||
public function testCanBeCreated() {
|
||||
$this->assertInstanceOf(PhpVersionRequirement::class, $this->requirement);
|
||||
}
|
||||
|
||||
public function testVersionConstraintCanBeRetrieved() {
|
||||
$this->assertEquals('7.1.0', $this->requirement->getVersionConstraint()->asString());
|
||||
}
|
||||
}
|
63
Laravel/vendor/phar-io/manifest/tests/values/RequirementCollectionTest.php
vendored
Normal file
63
Laravel/vendor/phar-io/manifest/tests/values/RequirementCollectionTest.php
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of PharIo\Manifest.
|
||||
*
|
||||
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace PharIo\Manifest;
|
||||
|
||||
use PharIo\Version\ExactVersionConstraint;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* @covers \PharIo\Manifest\RequirementCollection
|
||||
* @covers \PharIo\Manifest\RequirementCollectionIterator
|
||||
*
|
||||
* @uses \PharIo\Manifest\PhpVersionRequirement
|
||||
* @uses \PharIo\Version\VersionConstraint
|
||||
*/
|
||||
class RequirementCollectionTest extends TestCase {
|
||||
/**
|
||||
* @var RequirementCollection
|
||||
*/
|
||||
private $collection;
|
||||
|
||||
/**
|
||||
* @var Requirement
|
||||
*/
|
||||
private $item;
|
||||
|
||||
protected function setUp() {
|
||||
$this->collection = new RequirementCollection;
|
||||
$this->item = new PhpVersionRequirement(new ExactVersionConstraint('7.1.0'));
|
||||
}
|
||||
|
||||
public function testCanBeCreated() {
|
||||
$this->assertInstanceOf(RequirementCollection::class, $this->collection);
|
||||
}
|
||||
|
||||
public function testCanBeCounted() {
|
||||
$this->collection->add($this->item);
|
||||
|
||||
$this->assertCount(1, $this->collection);
|
||||
}
|
||||
|
||||
public function testCanBeIterated() {
|
||||
$this->collection->add(new PhpVersionRequirement(new ExactVersionConstraint('5.6.0')));
|
||||
$this->collection->add($this->item);
|
||||
|
||||
$this->assertContains($this->item, $this->collection);
|
||||
}
|
||||
|
||||
public function testKeyPositionCanBeRetreived() {
|
||||
$this->collection->add($this->item);
|
||||
foreach($this->collection as $key => $item) {
|
||||
$this->assertEquals(0, $key);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
35
Laravel/vendor/phar-io/manifest/tests/values/UrlTest.php
vendored
Normal file
35
Laravel/vendor/phar-io/manifest/tests/values/UrlTest.php
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of PharIo\Manifest.
|
||||
*
|
||||
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace PharIo\Manifest;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* @covers PharIo\Manifest\Url
|
||||
*/
|
||||
class UrlTest extends TestCase {
|
||||
public function testCanBeCreatedForValidUrl() {
|
||||
$this->assertInstanceOf(Url::class, new Url('https://phar.io/'));
|
||||
}
|
||||
|
||||
public function testCanBeUsedAsString() {
|
||||
$this->assertEquals('https://phar.io/', new Url('https://phar.io/'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers PharIo\Manifest\InvalidUrlException
|
||||
*/
|
||||
public function testCannotBeCreatedForInvalidUrl() {
|
||||
$this->expectException(InvalidUrlException::class);
|
||||
|
||||
new Url('invalid');
|
||||
}
|
||||
}
|
18
Laravel/vendor/phar-io/manifest/tests/xml/AuthorElementCollectionTest.php
vendored
Normal file
18
Laravel/vendor/phar-io/manifest/tests/xml/AuthorElementCollectionTest.php
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace PharIo\Manifest;
|
||||
|
||||
use DOMDocument;
|
||||
|
||||
class AuthorElementCollectionTest extends \PHPUnit_Framework_TestCase {
|
||||
public function testAuthorElementCanBeRetrievedFromCollection() {
|
||||
$dom = new DOMDocument();
|
||||
$dom->loadXML('<?xml version="1.0" ?><author xmlns="https://phar.io/xml/manifest/1.0" name="Reiner Zufall" email="reiner@zufall.de" />');
|
||||
$collection = new AuthorElementCollection($dom->childNodes);
|
||||
|
||||
foreach($collection as $authorElement) {
|
||||
$this->assertInstanceOf(AuthorElement::class, $authorElement);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
25
Laravel/vendor/phar-io/manifest/tests/xml/AuthorElementTest.php
vendored
Normal file
25
Laravel/vendor/phar-io/manifest/tests/xml/AuthorElementTest.php
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace PharIo\Manifest;
|
||||
|
||||
class AuthorElementTest extends \PHPUnit_Framework_TestCase {
|
||||
/**
|
||||
* @var AuthorElement
|
||||
*/
|
||||
private $author;
|
||||
|
||||
protected function setUp() {
|
||||
$dom = new \DOMDocument();
|
||||
$dom->loadXML('<?xml version="1.0" ?><author xmlns="https://phar.io/xml/manifest/1.0" name="Reiner Zufall" email="reiner@zufall.de" />');
|
||||
$this->author = new AuthorElement($dom->documentElement);
|
||||
}
|
||||
|
||||
public function testNameCanBeRetrieved() {
|
||||
$this->assertEquals('Reiner Zufall', $this->author->getName());
|
||||
}
|
||||
|
||||
public function testEmailCanBeRetrieved() {
|
||||
$this->assertEquals('reiner@zufall.de', $this->author->getEmail());
|
||||
}
|
||||
|
||||
}
|
41
Laravel/vendor/phar-io/manifest/tests/xml/BundlesElementTest.php
vendored
Normal file
41
Laravel/vendor/phar-io/manifest/tests/xml/BundlesElementTest.php
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace PharIo\Manifest;
|
||||
|
||||
use DOMDocument;
|
||||
|
||||
class BundlesElementTest extends \PHPUnit_Framework_TestCase {
|
||||
/**
|
||||
* @var DOMDocument
|
||||
*/
|
||||
private $dom;
|
||||
|
||||
/**
|
||||
* @var BundlesElement
|
||||
*/
|
||||
private $bundles;
|
||||
|
||||
protected function setUp() {
|
||||
$this->dom = new DOMDocument();
|
||||
$this->dom->loadXML('<?xml version="1.0" ?><bundles xmlns="https://phar.io/xml/manifest/1.0" />');
|
||||
$this->bundles = new BundlesElement($this->dom->documentElement);
|
||||
}
|
||||
|
||||
public function testThrowsExceptionWhenGetComponentElementsIsCalledButNodesAreMissing() {
|
||||
$this->expectException(ManifestElementException::class);
|
||||
$this->bundles->getComponentElements();
|
||||
}
|
||||
|
||||
public function testGetComponentElementsReturnsComponentElementCollection() {
|
||||
$this->addComponent();
|
||||
$this->assertInstanceOf(
|
||||
ComponentElementCollection::class, $this->bundles->getComponentElements()
|
||||
);
|
||||
}
|
||||
|
||||
private function addComponent() {
|
||||
$this->dom->documentElement->appendChild(
|
||||
$this->dom->createElementNS('https://phar.io/xml/manifest/1.0', 'component')
|
||||
);
|
||||
}
|
||||
}
|
18
Laravel/vendor/phar-io/manifest/tests/xml/ComponentElementCollectionTest.php
vendored
Normal file
18
Laravel/vendor/phar-io/manifest/tests/xml/ComponentElementCollectionTest.php
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace PharIo\Manifest;
|
||||
|
||||
use DOMDocument;
|
||||
|
||||
class ComponentElementCollectionTest extends \PHPUnit_Framework_TestCase {
|
||||
public function testComponentElementCanBeRetrievedFromCollection() {
|
||||
$dom = new DOMDocument();
|
||||
$dom->loadXML('<?xml version="1.0" ?><component xmlns="https://phar.io/xml/manifest/1.0" />');
|
||||
$collection = new ComponentElementCollection($dom->childNodes);
|
||||
|
||||
foreach($collection as $componentElement) {
|
||||
$this->assertInstanceOf(ComponentElement::class, $componentElement);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
25
Laravel/vendor/phar-io/manifest/tests/xml/ComponentElementTest.php
vendored
Normal file
25
Laravel/vendor/phar-io/manifest/tests/xml/ComponentElementTest.php
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace PharIo\Manifest;
|
||||
|
||||
class ComponentElementTest extends \PHPUnit_Framework_TestCase {
|
||||
/**
|
||||
* @var ComponentElement
|
||||
*/
|
||||
private $component;
|
||||
|
||||
protected function setUp() {
|
||||
$dom = new \DOMDocument();
|
||||
$dom->loadXML('<?xml version="1.0" ?><component xmlns="https://phar.io/xml/manifest/1.0" name="phar-io/phive" version="0.6.0" />');
|
||||
$this->component = new ComponentElement($dom->documentElement);
|
||||
}
|
||||
|
||||
public function testNameCanBeRetrieved() {
|
||||
$this->assertEquals('phar-io/phive', $this->component->getName());
|
||||
}
|
||||
|
||||
public function testEmailCanBeRetrieved() {
|
||||
$this->assertEquals('0.6.0', $this->component->getVersion());
|
||||
}
|
||||
|
||||
}
|
63
Laravel/vendor/phar-io/manifest/tests/xml/ContainsElementTest.php
vendored
Normal file
63
Laravel/vendor/phar-io/manifest/tests/xml/ContainsElementTest.php
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
namespace PharIo\Manifest;
|
||||
|
||||
use DOMDocument;
|
||||
use DOMElement;
|
||||
|
||||
class ContainsElementTest extends \PHPUnit_Framework_TestCase {
|
||||
/**
|
||||
* @var DOMElement
|
||||
*/
|
||||
private $domElement;
|
||||
|
||||
/**
|
||||
* @var ContainsElement
|
||||
*/
|
||||
private $contains;
|
||||
|
||||
protected function setUp() {
|
||||
$dom = new DOMDocument();
|
||||
$dom->loadXML('<?xml version="1.0" ?><php xmlns="https://phar.io/xml/manifest/1.0" name="phpunit/phpunit" version="5.6.5" type="application" />');
|
||||
$this->domElement = $dom->documentElement;
|
||||
$this->contains = new ContainsElement($this->domElement);
|
||||
}
|
||||
|
||||
public function testVersionCanBeRetrieved() {
|
||||
$this->assertEquals('5.6.5', $this->contains->getVersion());
|
||||
}
|
||||
|
||||
public function testThrowsExceptionWhenVersionAttributeIsMissing() {
|
||||
$this->domElement->removeAttribute('version');
|
||||
$this->expectException(ManifestElementException::class);
|
||||
$this->contains->getVersion();
|
||||
}
|
||||
|
||||
public function testNameCanBeRetrieved() {
|
||||
$this->assertEquals('phpunit/phpunit', $this->contains->getName());
|
||||
}
|
||||
|
||||
public function testThrowsExceptionWhenNameAttributeIsMissing() {
|
||||
$this->domElement->removeAttribute('name');
|
||||
$this->expectException(ManifestElementException::class);
|
||||
$this->contains->getName();
|
||||
}
|
||||
|
||||
public function testTypeCanBeRetrieved() {
|
||||
$this->assertEquals('application', $this->contains->getType());
|
||||
}
|
||||
|
||||
public function testThrowsExceptionWhenTypeAttributeIsMissing() {
|
||||
$this->domElement->removeAttribute('type');
|
||||
$this->expectException(ManifestElementException::class);
|
||||
$this->contains->getType();
|
||||
}
|
||||
|
||||
public function testGetExtensionElementReturnsExtensionElement() {
|
||||
$this->domElement->appendChild(
|
||||
$this->domElement->ownerDocument->createElementNS('https://phar.io/xml/manifest/1.0', 'extension')
|
||||
);
|
||||
$this->assertInstanceOf(ExtensionElement::class, $this->contains->getExtensionElement());
|
||||
}
|
||||
|
||||
}
|
52
Laravel/vendor/phar-io/manifest/tests/xml/CopyrightElementTest.php
vendored
Normal file
52
Laravel/vendor/phar-io/manifest/tests/xml/CopyrightElementTest.php
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
namespace PharIo\Manifest;
|
||||
|
||||
use DOMDocument;
|
||||
|
||||
class CopyrightElementTest extends \PHPUnit_Framework_TestCase {
|
||||
/**
|
||||
* @var DOMDocument
|
||||
*/
|
||||
private $dom;
|
||||
|
||||
/**
|
||||
* @var CopyrightElement
|
||||
*/
|
||||
private $copyright;
|
||||
|
||||
protected function setUp() {
|
||||
$this->dom = new DOMDocument();
|
||||
$this->dom->loadXML('<?xml version="1.0" ?><copyright xmlns="https://phar.io/xml/manifest/1.0" />');
|
||||
$this->copyright = new CopyrightElement($this->dom->documentElement);
|
||||
}
|
||||
|
||||
public function testThrowsExceptionWhenGetAuthroElementsIsCalledButNodesAreMissing() {
|
||||
$this->expectException(ManifestElementException::class);
|
||||
$this->copyright->getAuthorElements();
|
||||
}
|
||||
|
||||
public function testThrowsExceptionWhenGetLicenseElementIsCalledButNodeIsMissing() {
|
||||
$this->expectException(ManifestElementException::class);
|
||||
$this->copyright->getLicenseElement();
|
||||
}
|
||||
|
||||
public function testGetAuthorElementsReturnsAuthorElementCollection() {
|
||||
$this->dom->documentElement->appendChild(
|
||||
$this->dom->createElementNS('https://phar.io/xml/manifest/1.0', 'author')
|
||||
);
|
||||
$this->assertInstanceOf(
|
||||
AuthorElementCollection::class, $this->copyright->getAuthorElements()
|
||||
);
|
||||
}
|
||||
|
||||
public function testGetLicenseElementReturnsLicenseElement() {
|
||||
$this->dom->documentElement->appendChild(
|
||||
$this->dom->createElementNS('https://phar.io/xml/manifest/1.0', 'license')
|
||||
);
|
||||
$this->assertInstanceOf(
|
||||
LicenseElement::class, $this->copyright->getLicenseElement()
|
||||
);
|
||||
}
|
||||
|
||||
}
|
19
Laravel/vendor/phar-io/manifest/tests/xml/ExtElementCollectionTest.php
vendored
Normal file
19
Laravel/vendor/phar-io/manifest/tests/xml/ExtElementCollectionTest.php
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace PharIo\Manifest;
|
||||
|
||||
use DOMDocument;
|
||||
|
||||
class ExtElementCollectionTest extends \PHPUnit_Framework_TestCase {
|
||||
public function testComponentElementCanBeRetrievedFromCollection() {
|
||||
$dom = new DOMDocument();
|
||||
$dom->loadXML('<?xml version="1.0" ?><ext xmlns="https://phar.io/xml/manifest/1.0" />');
|
||||
$collection = new ExtElementCollection($dom->childNodes);
|
||||
|
||||
foreach($collection as $position => $extElement) {
|
||||
$this->assertInstanceOf(ExtElement::class, $extElement);
|
||||
$this->assertEquals(0, $position);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
21
Laravel/vendor/phar-io/manifest/tests/xml/ExtElementTest.php
vendored
Normal file
21
Laravel/vendor/phar-io/manifest/tests/xml/ExtElementTest.php
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace PharIo\Manifest;
|
||||
|
||||
class ExtElementTest extends \PHPUnit_Framework_TestCase {
|
||||
/**
|
||||
* @var ExtElement
|
||||
*/
|
||||
private $ext;
|
||||
|
||||
protected function setUp() {
|
||||
$dom = new \DOMDocument();
|
||||
$dom->loadXML('<?xml version="1.0" ?><ext xmlns="https://phar.io/xml/manifest/1.0" name="dom" />');
|
||||
$this->ext = new ExtElement($dom->documentElement);
|
||||
}
|
||||
|
||||
public function testNameCanBeRetrieved() {
|
||||
$this->assertEquals('dom', $this->ext->getName());
|
||||
}
|
||||
|
||||
}
|
25
Laravel/vendor/phar-io/manifest/tests/xml/ExtensionElementTest.php
vendored
Normal file
25
Laravel/vendor/phar-io/manifest/tests/xml/ExtensionElementTest.php
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace PharIo\Manifest;
|
||||
|
||||
class ExtensionElementTest extends \PHPUnit_Framework_TestCase {
|
||||
/**
|
||||
* @var ExtensionElement
|
||||
*/
|
||||
private $extension;
|
||||
|
||||
protected function setUp() {
|
||||
$dom = new \DOMDocument();
|
||||
$dom->loadXML('<?xml version="1.0" ?><extension xmlns="https://phar.io/xml/manifest/1.0" for="phar-io/phive" compatible="~0.6" />');
|
||||
$this->extension = new ExtensionElement($dom->documentElement);
|
||||
}
|
||||
|
||||
public function testNForCanBeRetrieved() {
|
||||
$this->assertEquals('phar-io/phive', $this->extension->getFor());
|
||||
}
|
||||
|
||||
public function testCompatibleVersionConstraintCanBeRetrieved() {
|
||||
$this->assertEquals('~0.6', $this->extension->getCompatible());
|
||||
}
|
||||
|
||||
}
|
25
Laravel/vendor/phar-io/manifest/tests/xml/LicenseElementTest.php
vendored
Normal file
25
Laravel/vendor/phar-io/manifest/tests/xml/LicenseElementTest.php
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace PharIo\Manifest;
|
||||
|
||||
class LicenseElementTest extends \PHPUnit_Framework_TestCase {
|
||||
/**
|
||||
* @var LicenseElement
|
||||
*/
|
||||
private $license;
|
||||
|
||||
protected function setUp() {
|
||||
$dom = new \DOMDocument();
|
||||
$dom->loadXML('<?xml version="1.0" ?><license xmlns="https://phar.io/xml/manifest/1.0" type="BSD-3" url="https://some.tld/LICENSE" />');
|
||||
$this->license = new LicenseElement($dom->documentElement);
|
||||
}
|
||||
|
||||
public function testTypeCanBeRetrieved() {
|
||||
$this->assertEquals('BSD-3', $this->license->getType());
|
||||
}
|
||||
|
||||
public function testUrlCanBeRetrieved() {
|
||||
$this->assertEquals('https://some.tld/LICENSE', $this->license->getUrl());
|
||||
}
|
||||
|
||||
}
|
110
Laravel/vendor/phar-io/manifest/tests/xml/ManifestDocumentTest.php
vendored
Normal file
110
Laravel/vendor/phar-io/manifest/tests/xml/ManifestDocumentTest.php
vendored
Normal file
@@ -0,0 +1,110 @@
|
||||
<?php
|
||||
|
||||
namespace PharIo\Manifest;
|
||||
|
||||
class ManifestDocumentTest extends \PHPUnit_Framework_TestCase {
|
||||
public function testThrowsExceptionWhenFileDoesNotExist() {
|
||||
$this->expectException(ManifestDocumentException::class);
|
||||
ManifestDocument::fromFile('/does/not/exist');
|
||||
}
|
||||
|
||||
public function testCanBeCreatedFromFile() {
|
||||
$this->assertInstanceOf(
|
||||
ManifestDocument::class,
|
||||
ManifestDocument::fromFile(__DIR__ . '/../_fixture/phpunit-5.6.5.xml')
|
||||
);
|
||||
}
|
||||
|
||||
public function testCaneBeConstructedFromString() {
|
||||
$content = file_get_contents(__DIR__ . '/../_fixture/phpunit-5.6.5.xml');
|
||||
$this->assertInstanceOf(
|
||||
ManifestDocument::class,
|
||||
ManifestDocument::fromString($content)
|
||||
);
|
||||
}
|
||||
|
||||
public function testThrowsExceptionOnInvalidXML() {
|
||||
$this->expectException(ManifestDocumentLoadingException::class);
|
||||
ManifestDocument::fromString('<?xml version="1.0" ?><root>');
|
||||
}
|
||||
|
||||
public function testLoadingDocumentWithWrongRootNameThrowsException() {
|
||||
$this->expectException(ManifestDocumentException::class);
|
||||
ManifestDocument::fromString('<?xml version="1.0" ?><root />');
|
||||
}
|
||||
|
||||
public function testLoadingDocumentWithWrongNamespaceThrowsException() {
|
||||
$this->expectException(ManifestDocumentException::class);
|
||||
ManifestDocument::fromString('<?xml version="1.0" ?><phar xmlns="foo:bar" />');
|
||||
}
|
||||
|
||||
public function testContainsElementCanBeRetrieved() {
|
||||
$this->assertInstanceOf(
|
||||
ContainsElement::class,
|
||||
$this->loadFixture()->getContainsElement()
|
||||
);
|
||||
}
|
||||
|
||||
public function testRequiresElementCanBeRetrieved() {
|
||||
$this->assertInstanceOf(
|
||||
RequiresElement::class,
|
||||
$this->loadFixture()->getRequiresElement()
|
||||
);
|
||||
}
|
||||
|
||||
public function testCopyrightElementCanBeRetrieved() {
|
||||
$this->assertInstanceOf(
|
||||
CopyrightElement::class,
|
||||
$this->loadFixture()->getCopyrightElement()
|
||||
);
|
||||
}
|
||||
|
||||
public function testBundlesElementCanBeRetrieved() {
|
||||
$this->assertInstanceOf(
|
||||
BundlesElement::class,
|
||||
$this->loadFixture()->getBundlesElement()
|
||||
);
|
||||
}
|
||||
|
||||
public function testThrowsExceptionWhenContainsIsMissing() {
|
||||
$this->expectException(ManifestDocumentException::class);
|
||||
$this->loadEmptyFixture()->getContainsElement();
|
||||
}
|
||||
|
||||
public function testThrowsExceptionWhenCopyirhgtIsMissing() {
|
||||
$this->expectException(ManifestDocumentException::class);
|
||||
$this->loadEmptyFixture()->getCopyrightElement();
|
||||
}
|
||||
|
||||
public function testThrowsExceptionWhenRequiresIsMissing() {
|
||||
$this->expectException(ManifestDocumentException::class);
|
||||
$this->loadEmptyFixture()->getRequiresElement();
|
||||
}
|
||||
|
||||
public function testThrowsExceptionWhenBundlesIsMissing() {
|
||||
$this->expectException(ManifestDocumentException::class);
|
||||
$this->loadEmptyFixture()->getBundlesElement();
|
||||
}
|
||||
|
||||
public function testHasBundlesReturnsTrueWhenBundlesNodeIsPresent() {
|
||||
$this->assertTrue(
|
||||
$this->loadFixture()->hasBundlesElement()
|
||||
);
|
||||
}
|
||||
|
||||
public function testHasBundlesReturnsFalseWhenBundlesNoNodeIsPresent() {
|
||||
$this->assertFalse(
|
||||
$this->loadEmptyFixture()->hasBundlesElement()
|
||||
);
|
||||
}
|
||||
|
||||
private function loadFixture() {
|
||||
return ManifestDocument::fromFile(__DIR__ . '/../_fixture/phpunit-5.6.5.xml');
|
||||
}
|
||||
|
||||
private function loadEmptyFixture() {
|
||||
return ManifestDocument::fromString(
|
||||
'<?xml version="1.0" ?><phar xmlns="https://phar.io/xml/manifest/1.0" />'
|
||||
);
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user