Do not hard code PMA version in tests

This commit is contained in:
Madhura Jayaratne 2013-10-01 17:39:37 +05:30
parent 895cf76adf
commit 878488d469

View File

@ -24,15 +24,15 @@ class PMA_ConfigGenerator_Test extends PHPUnit_Framework_TestCase
/**
* Test for ConfigGenerator::getConfigFile
*
*
* @return void
*/
public function testGetConfigFile()
{
{
$GLOBALS['cfg']['AvailableCharsets'] = array();
$GLOBALS['PMA_Config'] = new PMA_Config();
unset($_SESSION['eol']);
$attr_instance = new ReflectionProperty("ConfigFile", "_instance");
$attr_instance->setAccessible(true);
$attr_instance->setValue(null, null);
@ -45,14 +45,15 @@ class PMA_ConfigGenerator_Test extends PHPUnit_Framework_TestCase
);
$cf->setPersistKeys(array("1/", 2));
$result = ConfigGenerator::getConfigFile();
$this->assertContains(
"<?php\n" .
"/*\n" .
" * Generated configuration file\n" .
" * Generated by: phpMyAdmin 4.1-dev setup script\n" .
" * Generated by: phpMyAdmin " .
$GLOBALS['PMA_Config']->get('PMA_VERSION') . " setup script\n" .
" * Date: " . date(DATE_RFC1123) ."\n" .
" */\n\n",
$result
@ -78,7 +79,7 @@ class PMA_ConfigGenerator_Test extends PHPUnit_Framework_TestCase
/**
* Test for ConfigGenerator::_getVarExport
*
*
* @return void
*/
public function testGetVarExport()
@ -86,7 +87,7 @@ class PMA_ConfigGenerator_Test extends PHPUnit_Framework_TestCase
$reflection = new \ReflectionClass('ConfigGenerator');
$method = $reflection->getMethod('_getVarExport');
$method->setAccessible(true);
$this->assertEquals(
'$cfg[\'var_name\'] = 1;' ."\n",
$method->invoke(null, 'var_name', 1, "\n")
@ -107,9 +108,9 @@ class PMA_ConfigGenerator_Test extends PHPUnit_Framework_TestCase
"\n"
)
);
$this->assertEquals(
'$cfg[\'var_name\'][\'1a\'] = \'foo\';' . "\n" .
'$cfg[\'var_name\'][\'1a\'] = \'foo\';' . "\n" .
'$cfg[\'var_name\'][\'b\'] = \'bar\';' . "\n",
$method->invoke(
null,
@ -125,11 +126,11 @@ class PMA_ConfigGenerator_Test extends PHPUnit_Framework_TestCase
/**
* Test for ConfigGenerator::_isZeroBasedArray
*
*
* @return void
*/
public function testIsZeroBasedArray()
{
{
$reflection = new \ReflectionClass('ConfigGenerator');
$method = $reflection->getMethod('_isZeroBasedArray');
$method->setAccessible(true);
@ -172,7 +173,7 @@ class PMA_ConfigGenerator_Test extends PHPUnit_Framework_TestCase
/**
* Test for ConfigGenerator::_exportZeroBasedArray
*
*
* @return void
*/
public function testExportZeroBasedArray()
@ -193,7 +194,7 @@ class PMA_ConfigGenerator_Test extends PHPUnit_Framework_TestCase
$arr = array(1, 2, 3, 4, 7, 'foo');
$result = $method->invoke(null, $arr, "\n");
$this->assertEquals(
'array(' . "\n" .
' 1,' . "\n" .