Bart\Git\Commit::messageRawBody PHP Method

messageRawBody() public method

public messageRawBody ( ) : string
return string The unwrapped subject and body of the commit message (just the log message, not the author, etc.)
    public function messageRawBody()
    {
        return $this->gitShowFormatOutput('%%B', 'Could not get contents of commit');
    }

Usage Example

Beispiel #1
0
    public function testMessageRawBody()
    {
        $this->gitRoot = $this->shmock('\\Bart\\Git\\GitRoot', function ($root) {
            $output = 'TOP-338 run unit tests when Nate or Zack commit code

Change-Id: Iecb840ccccf70a79ae622c583761107aa1a1b7b9';
            $resultStub = new StubbedCommandResult([$output], 0);
            $root->getCommandResult("show -s --no-color --format='%%B' HEAD")->once()->return_value($resultStub);
        });
        $commit = new Commit($this->gitRoot, 'HEAD');
        // Assert all lines of log message are included
        $message = $commit->messageRawBody();
        $this->assertStringStartsWith('TOP-338', $message, 'No escape args silliness with quotes');
        $this->assertContains('TOP-338 run unit', $message, 'line one');
        $this->assertContains('Iecb840ccccf70a79ae622c583761107aa1a1b7b9', $message, 'line two');
    }