DeploynautLogFile::getLogFilePath PHP Method

getLogFilePath() public method

Return log file path, assuming it exists. Returns NULL if nothing found.
public getLogFilePath ( ) : string | null
return string | null
    public function getLogFilePath()
    {
        $path = $this->getSanitisedLogFilePath();
        // for backwards compatibility on old logs
        if (!file_exists($path)) {
            $path = $this->getRawFilePath();
            if (!file_exists($path)) {
                return null;
            }
        }
        return $path;
    }

Usage Example

 public function testLogDoesntExistMessage()
 {
     $log = new DeploynautLogFile('SomeSortOf Filename (UAT).log', $this->basePath);
     $this->assertNull($log->getLogFilePath());
     $this->assertEquals('Log has not been created yet.', $log->content());
 }