Bart\Git\Commit::messageSubject PHP Method

messageSubject() public method

public messageSubject ( ) : string
return string The first non-blank lines of the commit message
    public function messageSubject()
    {
        return $this->gitShowFormatOutput('%%s', 'Could not get contents of commit');
    }

Usage Example

Beispiel #1
0
 public function testMessageSubject()
 {
     // This test is pretty much a "it compiles" test
     $this->gitRoot = $this->shmock('\\Bart\\Git\\GitRoot', function ($root) {
         $output = 'TOP-338 run unit tests when Nate or Zack commit code';
         $resultStub = new StubbedCommandResult([$output], 0);
         $root->getCommandResult("show -s --no-color --format='%%s' HEAD")->once()->return_value($resultStub);
     });
     $commit = new Commit($this->gitRoot, 'HEAD');
     // Assert all lines of log message are included
     $message = $commit->messageSubject();
     $this->assertStringStartsWith('TOP-338', $message, 'No escape args silliness with quotes');
     $this->assertEquals('TOP-338 run unit tests when Nate or Zack commit code', $message, 'line one and only line one');
 }
All Usage Examples Of Bart\Git\Commit::messageSubject