public function testInstall() { $composer = new ComposerTestFramework\Composer\Wrapper(); $artifactDirectory = new \SplFileInfo($this->tempdir()); $pluginDirectory = new \SplFileInfo(realpath(__DIR__ . '/../../')); $projectDirectory = new \SplFileInfo($this->tempdir()); //var_dump($pluginDirectory, $artifactDirectory, $projectDirectory); $composer->archive($pluginDirectory, $artifactDirectory); $composerJson = new \SplTempFileObject(); $composerJsonContent = <<<composerJson { "repositories": [ { "type": "artifact", "url": "{$artifactDirectory}/" }, { "type": "composer", "url": "http://packages.firegento.com" } ], "require": { "cotya/composer-magento-plugin": "dev-master@dev", "firegento/psr0autoloader": "dev-master" } } composerJson; $composerJson->fwrite($composerJsonContent); $composer->install($projectDirectory, $composerJson); $this->assertFileNotExists($projectDirectory . '/vendor/magento-hackathon/magento-composer-installer/composer.json'); }
/** * @group local */ public function testComposerWrapperArchive() { $composer = new ComposerTestFramework\Composer\Wrapper(); $artifactDirectory = new \SplFileInfo($this->tempdir()); $packagesPath = __DIR__ . '/../../../composerMagentoPlugin/tests/res/packages'; $directory = new \DirectoryIterator($packagesPath); /** @var \DirectoryIterator $file */ foreach ($directory as $file) { if (!$file->isDot() && $file->isDir()) { $composer->archive($file, $artifactDirectory); } } $this->assertFileExists($artifactDirectory->getPathname() . '/magento-hackathon-magento-composer-installer-test-wildcard-1.0.0.zip'); $this->assertFileExists($artifactDirectory->getPathname() . '/magento-hackathon-magento-composer-installer-test-wildcard2-1.0.0.zip'); $this->assertFileExists($artifactDirectory->getPathname() . '/magento-hackathon-magento-composer-installer-test-library-1.0.0.zip'); }