public function testGetTree() { $git = new Git\Repository("./.git"); $tree = $git->getTree("c40b970eb68bd1c8980f1f97b57396f4c7ae107f"); $this->assertInstanceof("Git\\Tree", $tree); $this->assertEquals("c40b970eb68bd1c8980f1f97b57396f4c7ae107f", $tree->getId()); }
public function testGetTree() { $git = new Git\Repository(dirname(__DIR__) . "/.git/"); $tree = $git->getTree("c40b970eb68bd1c8980f1f97b57396f4c7ae107f"); $this->assertInstanceof("Git\\Tree", $tree); $this->assertEquals("c40b970eb68bd1c8980f1f97b57396f4c7ae107f", $tree->getId()); foreach ($tree->getIterator() as $entry) { $object = $entry->toObject(); $this->assertInstanceof("Git\\Object", $object); if ($object->getType() == GIT\Object\Blob) { $this->assertInstanceof("Git\\Blob", $object); } else { if ($object->getType() == GIT\Object\Tree) { $this->assertInstanceof("Git\\Tree", $object); } else { $this->fail("unhandled object found."); } } } }