Пример #1
0
 public function setUp()
 {
     parent::setUp();
     if (!extension_loaded('zip')) {
         $this->markTestSkipped('You need the zip extension to run this test.');
     }
 }
 /**
  * @inheritdoc
  */
 protected function setUp()
 {
     parent::setUp();
     $this->fs = new SymlinkFilesystem();
     $this->composer = new Composer();
     $this->config = new Config();
     $this->composer->setConfig($this->config);
     $this->vendorDir = realpath(sys_get_temp_dir()) . DIRECTORY_SEPARATOR . 'composer-test-vendor';
     $this->ensureDirectoryExistsAndClear($this->vendorDir);
     $this->binDir = realpath(sys_get_temp_dir()) . DIRECTORY_SEPARATOR . 'composer-test-bin';
     $this->ensureDirectoryExistsAndClear($this->binDir);
     $this->dependenciesDir = realpath(sys_get_temp_dir()) . DIRECTORY_SEPARATOR . 'composer-test-dependencies';
     $this->ensureDirectoryExistsAndClear($this->dependenciesDir);
     $this->symlinkDir = realpath(sys_get_temp_dir()) . DIRECTORY_SEPARATOR . 'composer-test-vendor-shared';
     $this->config->merge(array('config' => array('vendor-dir' => $this->vendorDir, 'bin-dir' => $this->binDir)));
     $this->dm = $this->getMockBuilder('Composer\\Downloader\\DownloadManager')->disableOriginalConstructor()->getMock();
     $this->composer->setDownloadManager($this->dm);
     /** @var RootPackage|\PHPUnit_Framework_MockObject_MockObject $package */
     $package = $this->getMock('Composer\\Package\\RootPackageInterface');
     $package->expects($this->any())->method('getExtra')->willReturn(array(SharedPackageInstaller::PACKAGE_TYPE => array('vendor-dir' => $this->dependenciesDir, 'symlink-dir' => $this->symlinkDir)));
     $this->composer->setPackage($package);
     $this->repository = $this->getMock('Composer\\Repository\\InstalledRepositoryInterface');
     $this->io = $this->getMock('Composer\\IO\\IOInterface');
     $this->dataManager = $this->getMockBuilder('LEtudiant\\Composer\\Data\\Package\\SharedPackageDataManager')->disableOriginalConstructor()->getMock();
 }
 /**
  * Setup.
  */
 protected function setUp()
 {
     parent::setUp();
     $this->vendorDir = realpath(sys_get_temp_dir()) . DIRECTORY_SEPARATOR . 'composer-test-vendor';
     $this->ensureDirectoryExistsAndClear($this->vendorDir);
     $this->composer = new \Composer\Composer();
     $config = new \Composer\Config();
     $this->composer->setConfig($config);
     /** @var \Composer\Package\RootPackageInterface|\PHPUnit_Framework_MockObject_MockObject $package */
     $package = $this->getMock('Composer\\Package\\RootPackageInterface');
     $package->expects($this->any())->method('getExtra')->willReturn(array(PhpCodesnifferStandardInstaller::PACKAGE_TYPE => array('vendor-dir' => $this->vendorDir)));
     $config->merge(array('config' => array('vendor-dir' => $this->vendorDir)));
     $this->composer->setPackage($package);
     $this->im = $this->getMock('Composer\\Installer\\InstallationManager');
     $this->composer->setInstallationManager($this->im);
     $this->io = $this->getMock('Composer\\IO\\IOInterface');
 }
 /**
  * @see PHPUnit_Framework_TestCase::setUp()
  */
 protected function setUp()
 {
     parent::setUp();
     // resetting idx counter for every test run
     $this->idx = 0;
     // setup COMPOSER_HOME and project folder in vfs
     $root = vfsStream::setup('/tests', null, array('home' => array(), 'project' => array()));
     $this->homeDir = $root->getChild('home')->url();
     $this->projectDir = $root->getChild('project')->url();
     putenv('COMPOSER_HOME=' . $this->homeDir);
     $this->io = $this->getMock('\\Composer\\IO\\IOInterface');
     $this->composer = $this->getMock('\\Composer\\Composer');
     // mock the AuthStoragePlugin to be able to return the path the vfs folder instead of relying on the getcwd()
     // call
     $this->authPlugin = $this->getMock('\\bitExpert\\Composer\\Auth\\AuthStorePlugin', array('getProjectDir'));
     $this->authPlugin->expects($this->any())->method('getProjectDir')->will($this->returnValue($this->projectDir));
 }