/**
     * Test for PMA_Tracker::testChangeTrackingData()
     *
     * @return void
     * @test
     */
    public function testChangeTrackingData()
    {
        if (!setupForTestsUsingDate()) {
            $this->markTestSkipped("Cannot override internal function date()");
        }

        $reflection = new \ReflectionProperty('PMA_Tracker', 'pma_table');
        $reflection->setAccessible(true);
        $reflection->setValue(null, 'pma_table_tracking');

        $this->assertFalse(
            PMA_Tracker::changeTrackingData("", "", "", "", "")
        );

        $GLOBALS['controllink'] = null;

        $dbi = $this->getMockBuilder('PMA_DatabaseInterface')
            ->disableOriginalConstructor()
            ->getMock();

        $sql_query_1 = " UPDATE pma_table_tracking" .
        " SET `schema_sql` = '# new_data_processed' " .
        " WHERE `db_name` = 'pma_db' " .
        " AND `table_name` = 'pma_table' " .
        " AND `version` = '1.0' ";

        $date  = date('Y-m-d H:i:s');

        $new_data = array(
            array(
                'username' => 'user1',
                'statement' => 'test_statement1'
            ),
            array(
                'username' => 'user2',
                'statement' => 'test_statement2'
            )
        );

        $sql_query_2 = " UPDATE pma_table_tracking" .
        " SET `data_sql` = '# log $date user1test_statement1\n" .
        "# log $date user2test_statement2\n' " .
        " WHERE `db_name` = 'pma_db' " .
        " AND `table_name` = 'pma_table' " .
        " AND `version` = '1.0' ";

        $dbi->expects($this->at(0))
            ->method('query')
            ->with($sql_query_1, null, 0, false)
            ->will($this->returnValue("executed_1"));

        $dbi->expects($this->at(1))
            ->method('query')
            ->with($sql_query_2, null, 0, false)
            ->will($this->returnValue("executed_2"));

        $GLOBALS['dbi'] = $dbi;

        $this->assertEquals(
            'executed_1',
            PMA_Tracker::changeTrackingData(
                'pma_db',
                'pma_table',
                '1.0',
                'DDL',
                "# new_data_processed"
            )
        );

        $this->assertEquals(
            'executed_2',
            PMA_Tracker::changeTrackingData(
                'pma_db',
                'pma_table',
                '1.0',
                'DML',
                $new_data
            )
        );

        tearDownForTestsUsingDate();
    }
 /**
  * Test for Tracker::testChangeTrackingData()
  *
  * @return void
  * @test
  */
 public function testChangeTrackingData()
 {
     if (!setupForTestsUsingDate()) {
         $this->markTestSkipped("Cannot override internal function date()");
     }
     $this->assertFalse(Tracker::changeTrackingData("", "", "", "", ""));
     $GLOBALS['controllink'] = null;
     $dbi = $this->getMockBuilder('PMA\\libraries\\DatabaseInterface')->disableOriginalConstructor()->getMock();
     $sql_query_1 = " UPDATE `pmadb`.`tracking`" . " SET `schema_sql` = '# new_data_processed' " . " WHERE `db_name` = 'pma_db' " . " AND `table_name` = 'pma_table' " . " AND `version` = '1.0' ";
     $date = date('Y-m-d H:i:s');
     $new_data = array(array('username' => 'user1', 'statement' => 'test_statement1'), array('username' => 'user2', 'statement' => 'test_statement2'));
     $sql_query_2 = " UPDATE `pmadb`.`tracking`" . " SET `data_sql` = '# log {$date} user1test_statement1\n" . "# log {$date} user2test_statement2\n' " . " WHERE `db_name` = 'pma_db' " . " AND `table_name` = 'pma_table' " . " AND `version` = '1.0' ";
     $dbi->method('query')->will($this->returnValueMap(array(array($sql_query_1, null, 0, false, "executed_1"), array($sql_query_2, null, 0, false, "executed_2"))));
     $dbi->expects($this->any())->method('escapeString')->will($this->returnArgument(0));
     $GLOBALS['dbi'] = $dbi;
     $this->assertEquals(true, Tracker::changeTrackingData('pma_db', 'pma_table', '1.0', 'DDL', "# new_data_processed"));
     $this->assertEquals(true, Tracker::changeTrackingData('pma_db', 'pma_table', '1.0', 'DML', $new_data));
     tearDownForTestsUsingDate();
 }