public function setUp() { $this->tmpdir = sys_get_temp_dir() . '/' . uniqid('conveyor'); $this->projectdir = $this->tmpdir . '/project'; $this->reposdir = $this->tmpdir . '/repos'; $this->reposurl = 'file:///' . $this->reposdir; $this->filesystem = new Filesystem(); $this->filesystem->mkdir($this->tmpdir); $this->filesystem->mkdir($this->projectdir); $svnadminbin = getenv('SVNADMIN_BIN') ? getenv('SVNADMIN_BIN') : '/usr/local/bin/svnadmin'; $svnbin = getenv('SVN_BIN') ? getenv('SVN_BIN') : '/usr/local/bin/svn'; if (!file_exists($svnadminbin)) { $this->markTestSkipped(sprintf('%s not found', $svnadminbin)); } if (!file_exists($svnbin)) { $this->markTestSkipped(sprintf('%s not found', $svnbin)); } $svnadmin = new Svnadmin($this->tmpdir, $svnadminbin); $svnadmin->create(basename($this->reposdir)); $svn = new Svn($this->reposurl, new CliAdapter($svnbin, new Cli(), new CliParser())); $svn->import(__DIR__ . '/../Test/Fixtures/skeleton/svn/trunk', '/', 'imported skeleton'); $svn->setHead(new Reference('2.1', Reference::TAG)); $svn->import(__DIR__ . '/../Test/Fixtures/skeleton/svn/tags/2.1', '/', 'imported skeleton'); $svn->setHead(new Reference('feature1', Reference::BRANCH)); $svn->import(__DIR__ . '/../Test/Fixtures/skeleton/svn/branches/feature1', '/', 'imported skeleton'); $content = file_get_contents(__DIR__ . '/../Test/Fixtures/conveyor.yml.twig'); $content = str_replace('{{ repository.url }}', $this->reposurl, $content); file_put_contents($this->projectdir . '/conveyor.yml', $content); chdir($this->projectdir); }
public function testCreate() { $cli = $this->getMock('Webcreate\\Util\\Cli', array('execute', 'getOutput', 'getErrorOutput')); $cli->expects($this->once())->method('execute')->with(xsprintf('/usr/local/bin/svnadmin create %xs', $this->svndir . '/test_test'))->will($this->returnValue(0)); $svnadmin = new Svnadmin($this->svndir, '/usr/local/bin/svnadmin', $cli); $svnadmin->create('test_test'); }