コード例 #1
0
 public function setUp()
 {
     parent::setUp();
     if (!extension_loaded('zip')) {
         $this->markTestSkipped('You need the zip extension to run this test.');
     }
 }
 /**
  * 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');
 }
コード例 #3
0
 /**
  * @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));
 }
コード例 #4
0
 public static function assertEquals($expected, $actual, $message = '', $delta = 0, $maxDepth = 10, $canonicalize = false, $ignoreCase = false)
 {
     return parent::assertEquals(str_replace("\r", '', $expected), str_replace("\r", '', $actual), $message, $delta, $maxDepth, $canonicalize, $ignoreCase);
 }
 /**
  * @inheritdoc
  */
 protected function tearDown()
 {
     $this->fs->removeDirectory($this->vendorDir);
     $this->fs->removeDirectory($this->binDir);
     $this->fs->removeDirectory($this->symlinkDir);
     $this->fs->removeDirectory($this->dependenciesDir);
     parent::tearDown();
 }
コード例 #6
0
ファイル: FactoryMock.php プロジェクト: neon64/composer
 public static function createConfig(IOInterface $io = null, $cwd = null)
 {
     $config = new Config(true, $cwd);
     $config->merge(array('config' => array('home' => TestCase::getUniqueTmpDirectory()), 'repositories' => array('packagist' => false)));
     return $config;
 }