/** * @Given I have initialised a git repository */ public function iHaveInitialisedAGitRepository() { $path = $this->getFileSystemPath(); $this->repository = Repository::open($path); $this->repository->init(); }
/** * @Given I initialize a repo */ public function iInitializeARepo() { $this->repo->init(); }
/** * testSubmodule */ public function testSubmodule() { $tempDir = realpath(sys_get_temp_dir()) . 'gitelephant_' . md5(uniqid(rand(), 1)); $tempName = tempnam($tempDir, 'gitelephant'); $path = $tempName; unlink($path); mkdir($path); $repository = new Repository($path); $repository->init(); $repository->addSubmodule($this->repository->getPath()); $repository->commit('test', true); $tree = $repository->getTree(); $this->assertContains('.gitmodules', $tree); $this->assertContains($this->repository->getHumanishName(), $tree); $submodule = $tree[0]; $this->assertEquals(Object::TYPE_LINK, $submodule->getType()); }