PMA\libraries\Tracker::getLogComment PHP Method

getLogComment() public static method

Returns the comment line for the log.
public static getLogComment ( ) : string
return string Comment, contains date and username
    public static function getLogComment()
    {
        $date = date('Y-m-d H:i:s');
        $user = preg_replace('/\\s+/', ' ', $GLOBALS['cfg']['Server']['user']);
        return "# log " . $date . " " . $user . "\n";
    }

Usage Example

 /**
  * Test for Tracker::getLogComment()
  *
  * @return void
  * @test
  */
 public function testGetLogComment()
 {
     if (!setupForTestsUsingDate()) {
         $this->markTestSkipped("Cannot override internal function date()");
     }
     $date = date('Y-m-d H:i:s');
     $GLOBALS['cfg']['Server']['user'] = "******";
     $this->assertEquals("# log {$date} pma_test_user\n", Tracker::getLogComment());
     tearDownForTestsUsingDate();
 }