/** * {@inheritdoc} */ public function tearDown() { if (false !== $this->envComposer) { putenv('COMPOSER=' . $this->envComposer); } if (false !== $this->envHome) { putenv('HOME=' . $this->envHome); } if (false !== $this->envComposerHome) { putenv('COMPOSER_HOME=' . $this->envComposerHome); } parent::tearDown(); }
/** * {@inheritDoc} */ protected function setUp() { parent::setUp(); // Redirect composer config and cache into the test temp dir. putenv('COMPOSER_HOME=' . $this->getTempDir() . DIRECTORY_SEPARATOR . '.composer'); $this->createFixture('.composer' . DIRECTORY_SEPARATOR . 'config.json', str_replace('##URL##', str_replace('\\', '/', $this->getTempDir() . DIRECTORY_SEPARATOR . 'test-repository' . DIRECTORY_SEPARATOR), $this->readFixture('composer' . DIRECTORY_SEPARATOR . 'config.json'))); $this->createFixture('test-repository' . DIRECTORY_SEPARATOR . 'packages.json', str_replace('##URL##', str_replace('\\', '/', $this->getTempDir() . DIRECTORY_SEPARATOR . 'test-repository' . DIRECTORY_SEPARATOR), $this->readFixture('test-repository' . DIRECTORY_SEPARATOR . 'packages.json'))); $this->provideFixture('test-repository' . DIRECTORY_SEPARATOR . 'vendor-package-name-1.0.0.zip'); $this->provideFixture('test-repository' . DIRECTORY_SEPARATOR . 'vendor-dependency-name-1.0.0.zip'); $this->provideFixture('test-repository' . DIRECTORY_SEPARATOR . 'vendor-dependency-name-1.1.0.zip'); // First we need a proper installation. $task = new InstallTask(new JsonArray([InstallTask::SETTING_TYPE => 'install', InstallTask::SETTING_ID => 'install-task-id', InstallTask::SETTING_PACKAGE => 'vendor/package-name', InstallTask::SETTING_VERSION => '1.0.0', InstallTask::SETTING_DESTINATION_DIR => $this->getTempDir(), 'status' => InstallTask::STATE_PENDING])); $task->perform($this->getTempFile('logs/install-task.log')); if ($task->getStatus() !== InstallTask::STATE_FINISHED) { $this->markTestSkipped('Remove package task can not be tested, test installation failed.'); return; } }