From 17d06dffc3f598c408298425170a44e6e897332d Mon Sep 17 00:00:00 2001 From: Flyingmana Date: Thu, 5 Nov 2020 23:01:06 +0100 Subject: [PATCH] rework generation of composer object --- .../Composer/Magento/PluginTest.php | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/tests/MagentoHackathon/Composer/Magento/PluginTest.php b/tests/MagentoHackathon/Composer/Magento/PluginTest.php index 4f08e0df..fc2e54be 100644 --- a/tests/MagentoHackathon/Composer/Magento/PluginTest.php +++ b/tests/MagentoHackathon/Composer/Magento/PluginTest.php @@ -30,9 +30,15 @@ class PluginTest extends \PHPUnit_Framework_TestCase protected $plugin; protected $eventManager; + private function buildComposerObject() + { + return \Composer\Factory::create($this->io); + } + public function setUp() { - $this->composer = new Composer; + $this->io = new \Composer\IO\NullIO(); + $this->composer = $this->buildComposerObject(); $this->config = $this->getMock('Composer\Config'); $this->composer->setConfig($this->config); $this->root = vfsStream::setup('root', null, array('vendor' => array('bin' => array()), 'htdocs' => array())); @@ -58,17 +64,16 @@ public function setUp() ), ))); - $this->composer->setInstallationManager(new InstallationManager()); - - $this->io = $this->getMock('Composer\IO\IOInterface'); $this->plugin = $this->getMockBuilder('MagentoHackathon\Composer\Magento\Plugin') ->setMethods(array('getEventManager', 'getModuleManager')) ->getMock(); - $repoManager = new RepositoryManager($this->io, $this->config); - $repoManager->setLocalRepository(new WritableArrayRepository); - $this->composer->setRepositoryManager($repoManager); + $repoManager = \Composer\Repository\RepositoryFactory::manager( + $this->io, + $this->config, + \Composer\Factory::createHttpDownloader($this->io, $this->config) + ); $this->eventManager = $this->getMock('MagentoHackathon\Composer\Magento\Event\EventManager'); $this->plugin