Beispiel #1
0
 public function getStatisticForPath($path)
 {
     $data = $this->exec(sprintf('log --no-color --pretty="tformat:%s" --name-only', Commit::$format));
     if (is_string($data)) {
         $data = array($data);
     }
     if (is_null($data)) {
         $data = array();
     }
     $commits = Commit::parse($data);
     return $commits;
 }
Beispiel #2
0
    public function testStaticParse()
    {
        $raw = <<<DATA
# ffe74f18630c4250531d44db8380bb550aec29ef
  David Moreau
  dav.m85@gmail.com
  1397926004
  adding tests suits
path1
path2
DATA;
        $commits = Commit::parse(explode(PHP_EOL, $raw));
        $this->assertTrue(is_array($commits));
        $this->assertCount(1, $commits);
        $commit = array_shift($commits);
        $this->assertEquals('ffe74f18630c4250531d44db8380bb550aec29ef', $commit->hash);
        $this->assertEquals('David Moreau', $commit->author);
        $this->assertEquals('*****@*****.**', $commit->email);
        $this->assertEquals('1397926004', $commit->timestamp);
        $this->assertEquals(array('path1', 'path2'), $commit->paths);
    }