object = $this->getMockForAbstractClass('PMA_Footer');
}
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*
* @access protected
* @return void
*/
protected function tearDown()
{
unset($this->object);
}
/**
* Call private functions by making the visibitlity to public.
*
* @param string $name method name
* @param array $params parameters for the invocation
*
* @return the output from the private method.
*/
private function _callPrivateFunction($name, $params)
{
$class = new ReflectionClass('PMA_Footer');
$method = $class->getMethod($name);
$method->setAccessible(true);
return $method->invokeArgs($this->object, $params);
}
/**
* Test for _getDebugMessage
*
* @group medium
*/
public function testGetDebugMessage(){
$_SESSION['debug']['queries'] = array('SELECT * FROM `pma_bookmark` WHERE 1', 'SELECT * FROM `db` WHERE 1');
$this->assertEquals(
$this->_callPrivateFunction(
'_getDebugMessage',
array()
),
'
2 queries executed 0 times in 0 seconds
Array
(
[queries] => Array
(
[0] => SELECT * FROM `pma_bookmark` WHERE 1
[1] => SELECT * FROM `db` WHERE 1
)
)
'
);
}
/**
* Test for _getSelfLink
*/
public function testGetSelfLink(){
$GLOBALS['cfg']['NavigationBarIconic'] = false;
$GLOBALS['cfg']['ServerDefault'] = 1;
$this->assertEquals(
$this->_callPrivateFunction(
'_getSelfLink',
array('db=mysql&token=1234')
),
''
);
}
/**
* Test for _getSelfLink
*/
public function testGetSelfLinkWithImage(){
$GLOBALS['cfg']['NavigationBarIconic'] = true;
$GLOBALS['cfg']['ServerDefault'] = 1;
$_SESSION['PMA_Theme'] = new PMA_Theme();
$GLOBALS['pmaThemeImage'] = 'image';
$this->assertEquals(
$this->_callPrivateFunction(
'_getSelfLink',
array('db=mysql&token=1234')
),
''
);
}
// /**
// * Test for disable
// */
// public function testDisable(){
//
// $GLOBALS['lang'] = 'en';
// $GLOBALS['collation_connection'] = 'utf8_general_ci';
// $GLOBALS['server'] = '1';
// $_SESSION[' PMA_token '] = 'token';
// $GLOBALS['reload'] = '1';
// $GLOBALS['focus_querywindow'] = 'main_pane_left';
//
// $footer = new PMA_Footer();
//
// $class = get_class( $footer );
// $reflection = new ReflectionClass( $class );
// $priv_attr = $reflection->getProperties( ReflectionProperty::IS_PRIVATE );
// $privates = array();
// $parseable = unserialize(str_replace("\0$class\0", "\0*\0", serialize($footer)));
// foreach($priv_attr as $attribute)
// {
// $aname = $attribute->name;
// $privates[$aname] = $parseable->$aname;
// }
//
// $this->assertFalse($priv_attr[3]->_isEnable);
// }
}