Bart\Git\Commit::committer PHP Method

committer() public method

The committer of the commit (person who last applied the work)
public committer ( ) : Person
return Person
    public function committer()
    {
        $name = $this->gitShowFormatOutput('%%cN', 'Could not get name of committer');
        $email = $this->gitShowFormatOutput('%%cE', 'Could not get email of committer');
        return new Person($name, $email);
    }

Usage Example

Beispiel #1
0
 public function testCommitter()
 {
     $expectedName = 'Committer Name';
     $expectedEmail = '*****@*****.**';
     $gitRoot = $this->shmock('\\Bart\\Git\\GitRoot', function ($root) use($expectedName, $expectedEmail) {
         $nameResultStub = new StubbedCommandResult([$expectedName], 0);
         $emailResultStub = new StubbedCommandResult([$expectedEmail], 0);
         $root->order_matters();
         $root->getCommandResult("show -s --no-color --format='%%cN' HEAD")->once()->return_value($nameResultStub);
         $root->getCommandResult("show -s --no-color --format='%%cE' HEAD")->once()->return_value($emailResultStub);
     });
     $commit = new Commit($gitRoot, 'HEAD');
     $person = $commit->committer();
     $actualName = $person->getName();
     $actualEmail = $person->getEmail();
     $this->assertSame($expectedName, $actualName);
     $this->assertSame($expectedEmail, $actualEmail);
 }