コード例 #1
0
ファイル: SvnDriverTest.php プロジェクト: songhongyu/idaiyan
 /**
  * @dataProvider getAssetTypes
  */
 public function testPublicRepositoryWithInvalidUrl($type, $filename, $identifier)
 {
     $this->setExpectedException('Composer\\Downloader\\TransportException');
     $repoUrl = 'svn://example.tld/composer-test/repo-name/trunk';
     $io = $this->getMock('Composer\\IO\\IOInterface');
     $repoConfig = array('url' => $repoUrl, 'asset-type' => $type, 'filename' => $filename);
     $process = $this->getMock('Composer\\Util\\ProcessExecutor');
     $process->expects($this->any())->method('splitLines')->will($this->returnValue(array()));
     $process->expects($this->any())->method('execute')->will($this->returnCallback(function ($command) {
         return 0 === strpos($command, 'svn cat ') ? 1 : 0;
     }));
     /* @var IOInterface $io */
     /* @var ProcessExecutor $process */
     $driver = new SvnDriver($repoConfig, $io, $this->config, $process, null);
     $driver->initialize();
     $driver->getComposerInformation($identifier);
 }
コード例 #2
0
 /**
  * @dataProvider getSupportsUrls
  *
  * @param string $url
  * @param string $supperted
  * @param string $urlUsed
  */
 public function testSupports($url, $supperted, $urlUsed)
 {
     /* @var IOInterface $io */
     $io = $this->getMockBuilder('Composer\\IO\\IOInterface')->getMock();
     $this->assertSame($supperted, SvnDriver::supports($io, $this->config, $url, false));
     if (!$supperted) {
         return;
     }
     $process = $this->getMockBuilder('Composer\\Util\\ProcessExecutor')->getMock();
     $process->expects($this->any())->method('execute')->will($this->returnCallback(function () {
         return 0;
     }));
     $repoConfig = array('url' => $url, 'asset-type' => 'bower', 'filename' => 'bower.json');
     /* @var IOInterface $io */
     /* @var ProcessExecutor $process */
     $driver = new SvnDriver($repoConfig, $io, $this->config, $process, null);
     $driver->initialize();
     $this->assertEquals($urlUsed, $driver->getUrl());
 }