From 12a31cc02501ada14f094eeae51c31a1562a032b Mon Sep 17 00:00:00 2001
From: Perreal Guillaume <guillaume.perreal@irstea.fr>
Date: Wed, 10 Jul 2019 17:48:56 +0200
Subject: [PATCH] =?UTF-8?q?Tentative=20d'ajout=20d'une=20couche=20d'abstra?=
 =?UTF-8?q?ction=20pour=20g=C3=A9rer=20plusieurs=20sources.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/Configuration/GithubRelease.php           | 17 ++++
 src/Configuration/MakeShim.php                |  2 +-
 .../Filter}/AcceptAllFilter.php               |  0
 .../Filter}/PackageFilterInterface.php        |  0
 .../Filter}/VersionFilter.php                 |  0
 src/{Packagist => Package}/Package.php        |  0
 src/Package/PackageInterface.php              | 46 +++++++++
 .../Packagist/Package.php}                    | 86 ++++++++--------
 src/Package/Packagist/PackageList.php         | 26 +++++
 src/{ => Package}/Packagist/Packagist.php     | 13 +--
 src/Package/Phive/Phive.php                   | 26 +++++
 src/Package/Phive/Repository.php              | 67 +++++++++++++
 src/Package/Phive/RepositoryList.php          | 53 ++++++++++
 .../ProviderInterface.php}                    |  8 +-
 src/container.php                             |  4 +-
 tests/Configuration/Composer/PackageTest.php  | 30 ++++++
 .../Phive/RepositoryListTest.php              | 34 +++++++
 tests/Configuration/Phive/RepositoryTest.php  | 35 +++++++
 tests/Configuration/Phive/fixtures/list.xml   | 99 +++++++++++++++++++
 .../Phive/fixtures/repository.xml             | 29 ++++++
 20 files changed, 519 insertions(+), 56 deletions(-)
 create mode 100644 src/Configuration/GithubRelease.php
 rename src/{Packagist => Package/Filter}/AcceptAllFilter.php (100%)
 rename src/{Packagist => Package/Filter}/PackageFilterInterface.php (100%)
 rename src/{Packagist => Package/Filter}/VersionFilter.php (100%)
 rename src/{Packagist => Package}/Package.php (100%)
 create mode 100644 src/Package/PackageInterface.php
 rename src/{Configuration/Composer.php => Package/Packagist/Package.php} (53%)
 create mode 100644 src/Package/Packagist/PackageList.php
 rename src/{ => Package}/Packagist/Packagist.php (88%)
 create mode 100644 src/Package/Phive/Phive.php
 create mode 100644 src/Package/Phive/Repository.php
 create mode 100644 src/Package/Phive/RepositoryList.php
 rename src/{Packagist/PackagistInterface.php => Package/ProviderInterface.php} (75%)
 create mode 100644 tests/Configuration/Composer/PackageTest.php
 create mode 100644 tests/Configuration/Phive/RepositoryListTest.php
 create mode 100644 tests/Configuration/Phive/RepositoryTest.php
 create mode 100644 tests/Configuration/Phive/fixtures/list.xml
 create mode 100644 tests/Configuration/Phive/fixtures/repository.xml

diff --git a/src/Configuration/GithubRelease.php b/src/Configuration/GithubRelease.php
new file mode 100644
index 0000000..0a16b2a
--- /dev/null
+++ b/src/Configuration/GithubRelease.php
@@ -0,0 +1,17 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of "irstea/make-shim".
+ * (c) 2019 Irstea <dsi.poleis@irstea.fr>
+ *
+ * For the full copyright and license information, please view the LICENSE.md
+ * file that was distributed with this source code.
+ */
+
+namespace Irstea\MakeShim\Configuration;
+
+/**
+ * Class GithubRelease.
+ */
+class GithubRelease
+{
+}
diff --git a/src/Configuration/MakeShim.php b/src/Configuration/MakeShim.php
index 3042bca..923a20d 100644
--- a/src/Configuration/MakeShim.php
+++ b/src/Configuration/MakeShim.php
@@ -16,7 +16,7 @@ use Symfony\Component\Config\Definition\Processor;
 use Symfony\Component\Yaml\Yaml;
 
 /**
- * Class MakeShim.
+ * Configuration file of the build command.
  */
 class MakeShim implements ConfigurationInterface
 {
diff --git a/src/Packagist/AcceptAllFilter.php b/src/Package/Filter/AcceptAllFilter.php
similarity index 100%
rename from src/Packagist/AcceptAllFilter.php
rename to src/Package/Filter/AcceptAllFilter.php
diff --git a/src/Packagist/PackageFilterInterface.php b/src/Package/Filter/PackageFilterInterface.php
similarity index 100%
rename from src/Packagist/PackageFilterInterface.php
rename to src/Package/Filter/PackageFilterInterface.php
diff --git a/src/Packagist/VersionFilter.php b/src/Package/Filter/VersionFilter.php
similarity index 100%
rename from src/Packagist/VersionFilter.php
rename to src/Package/Filter/VersionFilter.php
diff --git a/src/Packagist/Package.php b/src/Package/Package.php
similarity index 100%
rename from src/Packagist/Package.php
rename to src/Package/Package.php
diff --git a/src/Package/PackageInterface.php b/src/Package/PackageInterface.php
new file mode 100644
index 0000000..4d41b2d
--- /dev/null
+++ b/src/Package/PackageInterface.php
@@ -0,0 +1,46 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of "irstea/make-shim".
+ * (c) 2019 Irstea <dsi.poleis@irstea.fr>
+ *
+ * For the full copyright and license information, please view the LICENSE.md
+ * file that was distributed with this source code.
+ */
+
+namespace Irstea\MakeShim\Package;
+
+/**
+ * Interface PackageInterface.
+ */
+interface PackageInterface
+{
+    /**
+     * @return string
+     */
+    public function getName(): string;
+
+    /**
+     * @return string
+     */
+    public function getVersion(): string;
+
+    /**
+     * @return array
+     */
+    public function getComposerConfig(): array;
+
+    /**
+     * @return string
+     */
+    public function getBinaryPath(): string;
+
+    /**
+     * @return string
+     */
+    public function getArchiveURL(): string;
+
+    /**
+     * @return string|null
+     */
+    public function getSignatureURL(): ?string;
+}
diff --git a/src/Configuration/Composer.php b/src/Package/Packagist/Package.php
similarity index 53%
rename from src/Configuration/Composer.php
rename to src/Package/Packagist/Package.php
index 92f1e58..94aa7c1 100644
--- a/src/Configuration/Composer.php
+++ b/src/Package/Packagist/Package.php
@@ -7,18 +7,18 @@
  * file that was distributed with this source code.
  */
 
-namespace Irstea\MakeShim\Configuration;
+namespace Irstea\MakeShim\Configuration\Packagist;
 
-use Irstea\MakeShim\Packagist\Package;
+use Irstea\MakeShim\Packagist\Package as PackageObject;
 use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
 use Symfony\Component\Config\Definition\Builder\TreeBuilder;
 use Symfony\Component\Config\Definition\NodeInterface;
 use Symfony\Component\Config\Definition\Processor;
 
 /**
- * Class Composer.
+ * Allow to parse the parts of composer.json in whom we have some interest.
  */
-class Composer
+class Package
 {
     /** @var NodeInterface|null */
     private $configTree;
@@ -29,11 +29,11 @@ class Composer
     /**
      * @param array $config
      *
-     * @return Package
+     * @return PackageObject
      */
-    public function process(array $config): Package
+    public function process(array $config): PackageObject
     {
-        return Package::fromConfiguration(
+        return PackageObject::fromConfiguration(
             $this->getProcessor()->process(
                 $this->getConfigTree(),
                 [$config],
@@ -79,42 +79,42 @@ class Composer
         $rootNode
             ->ignoreExtraKeys()
             ->children()
-            ->scalarNode('name')->isRequired()->end()
-            ->scalarNode('version')->isRequired()->end()
-            ->scalarNode('type')->isRequired()->end()
-            ->scalarNode('homepage')->end()
-            ->arrayNode('keywords')->scalarPrototype()->end()->end()
-            ->arrayNode('authors')->variablePrototype()->end()->end()
-            ->arrayNode('license')
-            ->beforeNormalization()->castToArray()->end()
-            ->scalarPrototype()->end()
-            ->end()
-            ->arrayNode('bin')
-            ->isRequired()
-            ->requiresAtLeastOneElement()
-            ->scalarPrototype()->end()
-            ->end()
-            ->arrayNode('require')
-            ->beforeNormalization()
-            ->always(\Closure::fromCallable([$this, 'keepPlatformRequirements']))
-            ->end()
-            ->scalarPrototype()->end()
-            ->end()
-            ->arrayNode('suggest')
-            ->beforeNormalization()
-            ->always(\Closure::fromCallable([$this, 'keepPlatformRequirements']))
-            ->end()
-            ->scalarPrototype()->end()
-            ->end()
-            ->arrayNode('replace')
-            ->scalarPrototype()->end()
-            ->end()
-            ->arrayNode('conflicts')
-            ->beforeNormalization()
-            ->always(\Closure::fromCallable([$this, 'keepPlatformRequirements']))
-            ->end()
-            ->scalarPrototype()->end()
-            ->end()
+                ->scalarNode('name')->isRequired()->end()
+                ->scalarNode('version')->isRequired()->end()
+                ->scalarNode('type')->isRequired()->end()
+                ->scalarNode('homepage')->end()
+                ->arrayNode('keywords')->scalarPrototype()->end()->end()
+                ->arrayNode('authors')->variablePrototype()->end()->end()
+                ->arrayNode('license')
+                    ->beforeNormalization()->castToArray()->end()
+                    ->scalarPrototype()->end()
+                ->end()
+                ->arrayNode('bin')
+                    ->isRequired()
+                    ->requiresAtLeastOneElement()
+                    ->scalarPrototype()->end()
+                ->end()
+                ->arrayNode('require')
+                    ->beforeNormalization()
+                        ->always(\Closure::fromCallable([$this, 'keepPlatformRequirements']))
+                    ->end()
+                    ->scalarPrototype()->end()
+                ->end()
+                ->arrayNode('suggest')
+                    ->beforeNormalization()
+                        ->always(\Closure::fromCallable([$this, 'keepPlatformRequirements']))
+                    ->end()
+                    ->scalarPrototype()->end()
+                ->end()
+                ->arrayNode('replace')
+                    ->scalarPrototype()->end()
+                ->end()
+                ->arrayNode('conflicts')
+                    ->beforeNormalization()
+                        ->always(\Closure::fromCallable([$this, 'keepPlatformRequirements']))
+                    ->end()
+                    ->scalarPrototype()->end()
+                ->end()
             ->end();
 
         return $treeBuilder;
diff --git a/src/Package/Packagist/PackageList.php b/src/Package/Packagist/PackageList.php
new file mode 100644
index 0000000..779ca76
--- /dev/null
+++ b/src/Package/Packagist/PackageList.php
@@ -0,0 +1,26 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of "irstea/make-shim".
+ * (c) 2019 Irstea <dsi.poleis@irstea.fr>
+ *
+ * For the full copyright and license information, please view the LICENSE.md
+ * file that was distributed with this source code.
+ */
+
+namespace Irstea\MakeShim\Configuration\Packagist;
+
+use Symfony\Component\Config\Definition\ConfigurationInterface;
+
+/**
+ * Class PackageList.
+ */
+class PackageList implements ConfigurationInterface
+{
+    /**
+     * {@inheritdoc}
+     */
+    public function getConfigTreeBuilder()
+    {
+        // TODO: Implement getConfigTreeBuilder() method.
+    }
+}
diff --git a/src/Packagist/Packagist.php b/src/Package/Packagist/Packagist.php
similarity index 88%
rename from src/Packagist/Packagist.php
rename to src/Package/Packagist/Packagist.php
index 8a2a5b6..b7deb20 100644
--- a/src/Packagist/Packagist.php
+++ b/src/Package/Packagist/Packagist.php
@@ -13,6 +13,7 @@ use Assert\Assert;
 use GuzzleHttp\ClientInterface;
 use GuzzleHttp\Exception\GuzzleException;
 use Irstea\MakeShim\Configuration;
+use Irstea\MakeShim\Package\ProviderInterface;
 use Psr\Log\LoggerAwareInterface;
 use Psr\Log\LoggerAwareTrait;
 use Psr\Log\LoggerInterface;
@@ -24,7 +25,7 @@ use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
 /**
  * Class Packagist.
  */
-final class Packagist implements PackagistInterface, LoggerAwareInterface
+final class Packagist implements ProviderInterface, LoggerAwareInterface
 {
     use LoggerAwareTrait;
 
@@ -34,7 +35,7 @@ final class Packagist implements PackagistInterface, LoggerAwareInterface
     private const PACKAGIST_BASE_URL = 'https://repo.packagist.org/p';
 
     /**
-     * @var Configuration\Composer
+     * @var Configuration\Package
      */
     private $configuration;
 
@@ -46,11 +47,11 @@ final class Packagist implements PackagistInterface, LoggerAwareInterface
     /**
      * Packagist constructor.
      *
-     * @param ClientInterface        $client
-     * @param Configuration\Composer $configuration
-     * @param LoggerInterface|null   $logger
+     * @param ClientInterface       $client
+     * @param Configuration\Package $configuration
+     * @param LoggerInterface|null  $logger
      */
-    public function __construct(ClientInterface $client, Configuration\Composer $configuration, LoggerInterface $logger = null)
+    public function __construct(ClientInterface $client, Configuration\Package $configuration, LoggerInterface $logger = null)
     {
         $this->client = $client;
         $this->configuration = $configuration;
diff --git a/src/Package/Phive/Phive.php b/src/Package/Phive/Phive.php
new file mode 100644
index 0000000..2a0fdf9
--- /dev/null
+++ b/src/Package/Phive/Phive.php
@@ -0,0 +1,26 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of "irstea/make-shim".
+ * (c) 2019 Irstea <dsi.poleis@irstea.fr>
+ *
+ * For the full copyright and license information, please view the LICENSE.md
+ * file that was distributed with this source code.
+ */
+
+namespace Irstea\MakeShim\Package\Phive;
+
+use Irstea\MakeShim\Package\ProviderInterface;
+
+/**
+ * Class Phive.
+ */
+class Phive implements ProviderInterface
+{
+    /**
+     * {@inheritdoc}
+     */
+    public function enumerateVersions(string $packageName): array
+    {
+        // TODO: Implement enumerateVersions() method.
+    }
+}
diff --git a/src/Package/Phive/Repository.php b/src/Package/Phive/Repository.php
new file mode 100644
index 0000000..dd70164
--- /dev/null
+++ b/src/Package/Phive/Repository.php
@@ -0,0 +1,67 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of "irstea/make-shim".
+ * (c) 2019 Irstea <dsi.poleis@irstea.fr>
+ *
+ * For the full copyright and license information, please view the LICENSE.md
+ * file that was distributed with this source code.
+ */
+
+namespace Irstea\MakeShim\Configuration\Phive;
+
+use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
+use Symfony\Component\Config\Definition\Builder\TreeBuilder;
+use Symfony\Component\Config\Definition\ConfigurationInterface;
+
+/**
+ * Class Repository.
+ */
+class Repository implements ConfigurationInterface
+{
+    /**
+     * {@inheritdoc}
+     */
+    public function getConfigTreeBuilder()
+    {
+        $treeBuilder = new TreeBuilder('repository');
+
+        /** @var ArrayNodeDefinition $rootNode */
+        $rootNode = $treeBuilder->getRootNode();
+
+        $rootNode
+            ->fixXmlConfig('phar')
+            ->children()
+                ->arrayNode('phars')
+                    ->useAttributeAsKey('name', false)
+                    ->arrayPrototype()
+                        ->fixXmlConfig('release')
+                        ->children()
+                            ->scalarNode('name')->isRequired()->end()
+                            ->arrayNode('releases')
+                                ->useAttributeAsKey('version', false)
+                                ->arrayPrototype()
+                                    ->children()
+                                        ->scalarNode('version')->isRequired()->end()
+                                        ->scalarNode('url')->isRequired()->end()
+                                        ->arrayNode('signature')
+                                            ->children()
+                                                ->scalarNode('type')->end()
+                                            ->end()
+                                        ->end()
+                                        ->arrayNode('hash')
+                                            ->children()
+                                                ->scalarNode('type')->end()
+                                                ->scalarNode('value')->end()
+                                            ->end()
+                                        ->end()
+                                    ->end()
+                                ->end()
+                            ->end()
+                        ->end()
+                    ->end()
+                ->end()
+            ->end();
+
+        return $treeBuilder;
+    }
+}
diff --git a/src/Package/Phive/RepositoryList.php b/src/Package/Phive/RepositoryList.php
new file mode 100644
index 0000000..b4b3af0
--- /dev/null
+++ b/src/Package/Phive/RepositoryList.php
@@ -0,0 +1,53 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of "irstea/make-shim".
+ * (c) 2019 Irstea <dsi.poleis@irstea.fr>
+ *
+ * For the full copyright and license information, please view the LICENSE.md
+ * file that was distributed with this source code.
+ */
+
+namespace Irstea\MakeShim\Configuration\Phive;
+
+use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
+use Symfony\Component\Config\Definition\Builder\TreeBuilder;
+use Symfony\Component\Config\Definition\ConfigurationInterface;
+
+/**
+ * Class RepositoryList.
+ */
+class RepositoryList implements ConfigurationInterface
+{
+    /**
+     * {@inheritdoc}
+     */
+    public function getConfigTreeBuilder()
+    {
+        $treeBuilder = new TreeBuilder('repositories');
+
+        /** @var ArrayNodeDefinition $rootNode */
+        $rootNode = $treeBuilder->getRootNode();
+
+        $rootNode
+            ->fixXmlConfig('phar')
+            ->children()
+                ->arrayNode('phars')
+                    ->useAttributeAsKey('alias', false)
+                    ->arrayPrototype()
+                        ->children()
+                            ->scalarNode('alias')->isRequired()->end()
+                            ->scalarNode('composer')->end()
+                            ->arrayNode('repository')
+                                ->children()
+                                    ->scalarNode('type')->defaultValue('phive')->end()
+                                    ->scalarNode('url')->isRequired()->end()
+                                ->end()
+                            ->end()
+                        ->end()
+                    ->end()
+                ->end()
+            ->end();
+
+        return $treeBuilder;
+    }
+}
diff --git a/src/Packagist/PackagistInterface.php b/src/Package/ProviderInterface.php
similarity index 75%
rename from src/Packagist/PackagistInterface.php
rename to src/Package/ProviderInterface.php
index fd679de..4d0f329 100644
--- a/src/Packagist/PackagistInterface.php
+++ b/src/Package/ProviderInterface.php
@@ -7,17 +7,17 @@
  * file that was distributed with this source code.
  */
 
-namespace Irstea\MakeShim\Packagist;
+namespace Irstea\MakeShim\Package;
 
 /**
- * Interface PackagistInterface.
+ * Interface ProviderInterface.
  */
-interface PackagistInterface
+interface ProviderInterface
 {
     /**
      * @param string $packageName
      *
-     * @return Package[]
+     * @return PackageInterface[]
      */
     public function enumerateVersions(string $packageName): array;
 }
diff --git a/src/container.php b/src/container.php
index 42f0937..2f3c468 100644
--- a/src/container.php
+++ b/src/container.php
@@ -23,8 +23,8 @@ use GuzzleHttp\Client;
 use GuzzleHttp\HandlerStack;
 use Irstea\MakeShim\Builder\Builder;
 use Irstea\MakeShim\Command\BuildCommand;
-use Irstea\MakeShim\Configuration\Composer;
 use Irstea\MakeShim\Configuration\MakeShim;
+use Irstea\MakeShim\Configuration\Package;
 use Irstea\MakeShim\Packagist\Packagist;
 use Irstea\MakeShim\Packagist\VersionFilter;
 use Irstea\MakeShim\Repository\Factory;
@@ -58,7 +58,7 @@ $container['build-command'] = static function (Container $c) {
 $container['packagist'] = static function (Container $c) {
     return new Packagist(
         $c['http-client'],
-        new Composer(),
+        new Package(),
         $c['logger']
     );
 };
diff --git a/tests/Configuration/Composer/PackageTest.php b/tests/Configuration/Composer/PackageTest.php
new file mode 100644
index 0000000..48e2e04
--- /dev/null
+++ b/tests/Configuration/Composer/PackageTest.php
@@ -0,0 +1,30 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of "irstea/make-shim".
+ * (c) 2019 Irstea <dsi.poleis@irstea.fr>
+ *
+ * For the full copyright and license information, please view the LICENSE.md
+ * file that was distributed with this source code.
+ */
+
+namespace Irstea\MakeShim\Tests\Configuration\Composer;
+
+use Irstea\MakeShim\Configuration\Packagist\Package;
+use PHPUnit\Framework\TestCase;
+
+/**
+ * Class PackageListTest.
+ */
+final class PackageListTest extends TestCase
+{
+    public function testPackage(): void
+    {
+        $package = new Package();
+
+        $data = \Safe\json_decode(\Safe\file_get_contents(__DIR__ . '/../../../composer.json'), true);
+
+        $result = $package->process($data);
+
+        dump($result);
+    }
+}
diff --git a/tests/Configuration/Phive/RepositoryListTest.php b/tests/Configuration/Phive/RepositoryListTest.php
new file mode 100644
index 0000000..6101c30
--- /dev/null
+++ b/tests/Configuration/Phive/RepositoryListTest.php
@@ -0,0 +1,34 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of "irstea/make-shim".
+ * (c) 2019 Irstea <dsi.poleis@irstea.fr>
+ *
+ * For the full copyright and license information, please view the LICENSE.md
+ * file that was distributed with this source code.
+ */
+
+namespace Irstea\MakeShim\Tests\Configuration\Phive;
+
+use Irstea\MakeShim\Configuration\Phive\RepositoryList;
+use PHPUnit\Framework\TestCase;
+use Symfony\Component\Config\Definition\Processor;
+use Symfony\Component\Config\Util\XmlUtils;
+
+/**
+ * Class RepositoryListTest.
+ */
+final class RepositoryListTest extends TestCase
+{
+    public function testRepositoryList(): void
+    {
+        $domDocument = XmlUtils::loadFile(__DIR__ . '/fixtures/list.xml');
+        $input = XmlUtils::convertDomElementToArray($domDocument->documentElement);
+
+        $proc = new Processor();
+        $config = new RepositoryList();
+
+        $result = $proc->processConfiguration($config, [$input]);
+
+        self::assertIsArray($result);
+    }
+}
diff --git a/tests/Configuration/Phive/RepositoryTest.php b/tests/Configuration/Phive/RepositoryTest.php
new file mode 100644
index 0000000..277f465
--- /dev/null
+++ b/tests/Configuration/Phive/RepositoryTest.php
@@ -0,0 +1,35 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of "irstea/make-shim".
+ * (c) 2019 Irstea <dsi.poleis@irstea.fr>
+ *
+ * For the full copyright and license information, please view the LICENSE.md
+ * file that was distributed with this source code.
+ */
+
+namespace Irstea\MakeShim\Tests\Configuration\Phive;
+
+use Irstea\MakeShim\Configuration\Phive\Repository;
+use PHPUnit\Framework\TestCase;
+use Symfony\Component\Config\Definition\Processor;
+use Symfony\Component\Config\Util\XmlUtils;
+
+/**
+ * Class PhiveRepositoriesTest.
+ */
+final class RepositoryTest extends TestCase
+{
+    public function testRepository(): void
+    {
+        $domDocument = XmlUtils::loadFile(__DIR__ . '/fixtures/repository.xml');
+        $input = XmlUtils::convertDomElementToArray($domDocument->documentElement);
+
+        $proc = new Processor();
+        $config = new Repository();
+
+        $result = $proc->processConfiguration($config, [$input]);
+        dump($result);
+
+        self::assertIsArray($result);
+    }
+}
diff --git a/tests/Configuration/Phive/fixtures/list.xml b/tests/Configuration/Phive/fixtures/list.xml
new file mode 100644
index 0000000..3d33e63
--- /dev/null
+++ b/tests/Configuration/Phive/fixtures/list.xml
@@ -0,0 +1,99 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<repositories xmlns="https://phar.io/repository-list">
+    <phar alias="phpbench" composer="phpbench/phpbench">
+        <repository type="github" url="https://api.github.com/repos/phpbench/phpbench/releases" />
+    </phar>
+    <phar alias="infection" composer="infection/infection">
+        <repository type="github" url="https://api.github.com/repos/infection/infection/releases" />
+    </phar>
+    <phar alias="phpab" composer="theseer/autoload">
+        <repository type="github" url="https://api.github.com/repos/theseer/autoload/releases" />
+    </phar>
+    <phar alias="phpcpd" composer="sebastian/phpcpd">
+        <repository url="https://phar.phpunit.de/phive.xml"/>
+    </phar>
+    <phar alias="phpdox" composer="theseer/phpdox">
+        <repository type="github" url="https://api.github.com/repos/theseer/phpdox/releases" />
+    </phar>
+    <phar alias="phploc" composer="phploc/phploc">
+        <repository url="https://phar.phpunit.de/phive.xml"/>
+    </phar>
+    <phar alias="phpunit" composer="phpunit/phpunit">
+        <repository url="https://phar.phpunit.de/phive.xml"/>
+    </phar>
+    <phar alias="phpbu" composer="phpbu/phpbu">
+        <repository url="https://phar.phpbu.de/phive.xml"/>
+    </phar>
+    <phar alias="php-doc-check" composer="nielsdeblaauw/php-doc-check">
+        <repository type="github" url="https://api.github.com/repos/nielsdeblaauw/php-doc-check/releases"/>
+    </phar>
+    <phar alias="dephpend" composer="dephpend/dephpend">
+        <repository url="https://phar.dephpend.com/phive.xml"/>
+    </phar>
+    <phar alias="phpdocumentor" composer="phpdocumentor/phpdocumentor">
+        <repository type="github" url="https://api.github.com/repos/phpdocumentor/phpdocumentor2/releases" />
+    </phar>
+    <phar alias="carbon" composer="jpuck/carbon-console">
+        <repository type="github" url="https://api.github.com/repos/jpuck/carbon-console/releases" />
+    </phar>
+    <phar alias="composer-require-checker" composer="maglnet/composer-require-checker">
+        <repository type="github" url="https://api.github.com/repos/maglnet/ComposerRequireChecker/releases" />
+    </phar>
+    <phar alias="phpstan" composer="phpstan/phpstan">
+        <repository type="github" url="https://api.github.com/repos/phpstan/phpstan/releases" />
+    </phar>
+    <phar alias="phpcs" composer="squizlabs/php_codesniffer">
+        <repository url="https://squizlabs.github.io/PHP_CodeSniffer/phars/phive.xml" />
+    </phar>
+    <phar alias="phpcbf" composer="squizlabs/php_codesniffer">
+        <repository url="https://squizlabs.github.io/PHP_CodeSniffer/phars/phive.xml" />
+    </phar>
+    <phar alias="n98-magerun" composer="n98/magerun">
+        <repository url="https://files.magerun.net/phive.xml" />
+    </phar>
+    <phar alias="n98-magerun2" composer="n98/magerun2">
+        <repository url="https://files.magerun.net/phive.xml" />
+    </phar>
+    <phar alias="pipelines" composer="ktomk/pipelines">
+        <repository type="github" url="https://api.github.com/repos/ktomk/pipelines/releases" />
+    </phar>
+    <phar alias="phing" composer="phing/phing">
+        <repository type="github" url="https://api.github.com/repos/phingofficial/phing/releases" />
+    </phar>
+    <phar alias="psalm" composer="vimeo/psalm">
+        <repository type="github" url="https://api.github.com/repos/vimeo/psalm/releases" />
+    </phar>
+    <phar alias="clapi" composer="ngabor84/clapi">
+        <repository type="github" url="https://api.github.com/repos/ngabor84/clapi/releases" />
+    </phar>
+    <phar alias="sshman" composer="mwender/sshman">
+        <repository type="github" url="https://api.github.com/repos/mwender/sshman/releases" />
+    </phar>
+    <phar alias="php-coveralls" composer="php-coveralls/php-coveralls">
+        <repository type="github" url="https://api.github.com/repos/php-coveralls/php-coveralls/releases" />
+    </phar>
+    <phar alias="php-cs-fixer" composer="friendsofphp/php-cs-fixer">
+        <repository type="github" url="https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/releases" />
+    </phar>
+    <phar alias="phan" composer="phan/phan">
+        <repository type="github" url="https://api.github.com/repos/phan/phan/releases" />
+    </phar>
+    <phar alias="ecc" composer="ngabor84/ecc">
+        <repository type="github" url="https://api.github.com/repos/ngabor84/ecc/releases" />
+    </phar>
+    <phar alias="wp" composer="wp-cli/wp-cli">
+        <repository type="github" url="https://api.github.com/repos/wp-cli/wp-cli/releases" />
+    </phar>
+    <phar alias="psh" composer="shopware/psh">
+        <repository type="github" url="https://api.github.com/repos/shopwareLabs/psh/releases" />
+    </phar>
+    <phar alias="sw-cli-tools" composer="shopwarelabs/sw-cli-tools">
+        <repository type="github" url="https://api.github.com/repos/shopwareLabs/sw-cli-tools/releases" />
+    </phar>
+    <phar alias="paratest" composer="brianium/paratest">
+        <repository type="github" url="https://api.github.com/repos/paratestphp/paratest/releases" />
+    </phar>
+    <phar alias="deptrac" composer="sensiolabs-de/deptrac">
+        <repository type="github" url="https://api.github.com/repos/sensiolabs-de/deptrac/releases" />
+    </phar>
+</repositories>
diff --git a/tests/Configuration/Phive/fixtures/repository.xml b/tests/Configuration/Phive/fixtures/repository.xml
new file mode 100644
index 0000000..c77884b
--- /dev/null
+++ b/tests/Configuration/Phive/fixtures/repository.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0"?>
+<repository xmlns="https://phar.io/repository" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://phar.io/repository https://phar.io/data/repository.xsd">
+  <phar name="dephpend">
+    <release version="0.4.0" url="https://phar.dephpend.com/dephpend-0.4.0.phar">
+      <signature type="gpg"/>
+      <hash type="sha-256" value="72240f80b5ff05cc88d8eb23d989f633a456a3c96ed39a08b0fdbbf4d5c88b84"/>
+    </release>
+    <release version="0.3.2" url="https://phar.dephpend.com/dephpend-0.3.2.phar">
+      <signature type="gpg"/>
+      <hash type="sha-256" value="9e246643638a76d7a96259159d51dd8a6cdef5886fb2ef15ea1df8e84e3a2c34"/>
+    </release>
+    <release version="0.3.1" url="https://phar.dephpend.com/dephpend-0.3.1.phar">
+      <signature type="gpg"/>
+      <hash type="sha-256" value="08be1f0fe7c6de19c3df89b2203d1e5c83c520302002d95fd2013d76e6d2f683"/>
+    </release>
+    <release version="0.3.0" url="https://phar.dephpend.com/dephpend-0.3.0.phar">
+      <signature type="gpg"/>
+      <hash type="sha-256" value="e59d6816136c1ebe6aab3d07ffaeb8b136e844e5b922dac685fbba5faa2e52f8"/>
+    </release>
+    <release version="0.2.0" url="https://phar.dephpend.com/dephpend-0.2.0.phar">
+      <signature type="gpg"/>
+      <hash type="sha-256" value="74fbf5178d4b72f66428bcfb79448bc06e44bae75f4ca9a1ee4682c222e06448"/>
+    </release>
+    <release version="0.1.0" url="https://phar.dephpend.com/dephpend-0.1.0.phar">
+      <signature type="gpg"/>
+      <hash type="sha-256" value="7849206947e12cc45ee449be7b881df3236010d0e66b1ab2acf4044d5afe13b7"/>
+    </release>
+  </phar>
+</repository>
-- 
GitLab