public function testGitGetCommitFlomRepository() { $repository = new Git\Repository(".git"); $commit = $repository->getCommit("1f27eed71970a0dbc0ca758f449e4b68c4c91bd8"); $author = $commit->getAuthor(); $this->assertEquals("Shuhei Tanuma", $author->name); $this->assertEquals("*****@*****.**", $author->email); $committer = $commit->getCommitter(); $this->assertEquals("Shuhei Tanuma", $committer->name); $this->assertEquals("*****@*****.**", $committer->email); $this->assertEquals("1f27eed71970a0dbc0ca758f449e4b68c4c91bd8", $commit->getId()); $tree = $commit->getTree(); $entry1 = $tree->getEntry(0); $this->assertEquals("EXPERIMENTAL", $entry1->name); $this->assertEquals("35a136e7e190505e46367a04f730e827062b13cc", $entry1->oid); $entry2 = $tree->getEntry(1); $this->assertEquals("README.md", $entry2->name); $this->assertEquals("a1a07d27e9d8a78e3bc6fb8a6d8308d358ff9b07", $entry2->oid); $commit = $repository->getCommit("bba0bb972cbdc72d908ebd7c89157d7e207f5e92"); $parent = $commit->getParent(); $this->assertEquals("b500d73e7125ae105ce125b96390ad09d6174629", $parent->getId()); $author = $parent->getAuthor(); $this->assertEquals("Shuhei Tanuma", $author->name); $this->assertEquals("*****@*****.**", $author->email); $committer = $parent->getCommitter(); $this->assertEquals("Shuhei Tanuma", $committer->name); $this->assertEquals("*****@*****.**", $committer->email); }
public function testLookupRef() { $git = new Git\Repository(dirname(__DIR__) . "/.git/"); $ref = $git->lookupRef(self::$reference_name); $commit = $git->getCommit($ref->getId()); $this->assertInstanceof("Git\\Reference", $ref, "can't lookup reference"); $this->assertInstanceof("Git\\Commit", $commit, "reference can't return commit object"); }
public function testConstruct() { try { $git = new Git\Repository(PHP_GIT_FIXTURE_DIR . "/fixture.git"); $commit = $git->getCommit("7caa5b63e5fe4596543378e47b5225b6a1fa2dee"); } catch (\Exception $e) { $this->fail(); } unset($git); }