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"); }
/** * Reference failed when call getTarget(); */ public function testGitReferenceGetTarget() { $rep = new Git\Repository(dirname(__DIR__) . "/.git/"); $ref = $rep->lookupRef(self::$reference_name); try { $target = $ref->getTarget(); $this->fail("something wrong. this method allowed symbolic reference only."); } catch (Exception $e) { $this->assertTrue(true, "can't call getTarget method when lookup doesn't symbolic reference"); } }