public function testSetRepository() { $project = new GithubProject('Twig', 'fabpot/Twig'); $this->assertEquals('master', $project->getBranch()); $this->assertEquals('https://github.com/fabpot/Twig.git', $project->getRepository()); $this->assertEquals('https://github.com/fabpot/Twig/commit/%commit%', $project->getUrlPattern()); $project = new GithubProject('Twig', 'fabpot/Twig@foo'); $this->assertEquals('foo', $project->getBranch()); $this->assertEquals('https://github.com/fabpot/Twig.git', $project->getRepository()); $this->assertEquals('https://github.com/fabpot/Twig/commit/%commit%', $project->getUrlPattern()); }
/** * @dataProvider localRepositoryProvider */ public function testSetRepositoryLocal($url) { $fs = new Filesystem(); $repository = sys_get_temp_dir() . '/sismo/fabpot/Twig'; $fs->remove($repository); $fs->mkdir($repository); $process = new Process('git init && git remote add origin ' . $url, $repository); $process->run(); $project = new GithubProject('Twig', $repository); $this->assertEquals('master', $project->getBranch()); $this->assertEquals($repository, $project->getRepository()); $this->assertEquals('https://github.com/fabpot/Twig/commit/%commit%', $project->getUrlPattern()); $fs->remove($repository); }