/** * {@inheritdoc} */ protected function setUp() { parent::setUp(); $this->envComposer = getenv('COMPOSER'); $this->envHome = getenv('HOME'); $this->envComposerHome = getenv('COMPOSER_HOME'); putenv('COMPOSER'); putenv('HOME'); putenv('COMPOSER_HOME'); }
/** * {@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; } }