Example #1
0
 public function testConstructor()
 {
     $commit = new Commit(self::$repository, 'fccd14eaa8d5f7654ce838becb6b47e34f4bcc43');
     $this->assertEquals('fccd14eaa8d5f7654ce838becb6b47e34f4bcc43', $commit->getHash());
     $this->assertEquals(array('5ff8ff94448ef3882daf4b9121b847d8540a065b'), $commit->getParentHashes());
     $this->assertTrue(current($commit->getParents()) instanceof Commit, 'Parents are Git\\Commit');
     $this->assertEquals('884227673795f80c7ce03a79fabba733036401eb', $commit->getTreeHash());
     $this->assertTrue($commit->getTree() instanceof Tree, 'Tree is a Git\\Tree');
     $author = new User('Cécile HONXA', '*****@*****.**');
     $this->assertEquals($author, $commit->getAuthor(), 'Author infos are loaded');
     $this->assertTrue($commit->getAuthoredDate() instanceof \DateTime, 'AuthoredDate is a DateTime');
     $this->assertEquals('Lenny BARALAIR', $commit->getCommitter()->getName());
     $this->assertEquals('*****@*****.**', $commit->getCommitter()->getEmail());
     $this->assertEquals('Lenny BARALAIR <*****@*****.**>', strval($commit->getCommitter()));
     $this->assertTrue($commit->getCommittedDate() instanceof \DateTime, 'ComittedDate is a DateTime');
     $this->assertEquals('CREATE FILE3', $commit->getMessage(), 'Message received');
 }