Merge branch 'master' into fix-4134-v2

This commit is contained in:
Hugues Peccatte 2013-11-03 16:05:45 +01:00
commit 4c5f8ce584
78 changed files with 690 additions and 686 deletions

View File

@ -73,7 +73,8 @@ class ConfigFile
/**
* Constructor
*
* @param array $base_config base configuration read from {@link PMA_Config::$base_config},
* @param array $base_config base configuration read from
* {@link PMA_Config::$base_config},
* use only when not in PMA Setup
*/
public function __construct(array $base_config = null)
@ -209,7 +210,8 @@ class ConfigFile
$remove_path = $value === $default_value;
if ($this->_isInSetup) {
// remove if it has a default value or is empty
$remove_path = $remove_path || (empty($value) && empty($default_value));
$remove_path = $remove_path
|| (empty($value) && empty($default_value));
} else {
// get original config values not overwritten by user
// preferences to allow for overwriting options set in
@ -218,8 +220,10 @@ class ConfigFile
$canonical_path,
$this->_baseCfg
);
// remove if it has a default value and base config (config.inc.php) uses default value
$remove_path = $remove_path && ($instance_default_value === $default_value);
// remove if it has a default value and base config (config.inc.php)
// uses default value
$remove_path = $remove_path
&& ($instance_default_value === $default_value);
}
if ($remove_path) {
PMA_arrayRemove($path, $_SESSION[$this->_id]);

View File

@ -53,13 +53,14 @@ class Form
/**
* Constructor, reads default config values
*
* @param string $form_name Form name
* @param array $form Form data
* @param ConfigFile $cf Config file instance
* @param int $index arbitrary index, stored in Form::$index
* @param string $form_name Form name
* @param array $form Form data
* @param ConfigFile $cf Config file instance
* @param int $index arbitrary index, stored in Form::$index
*/
public function __construct($form_name, array $form, ConfigFile $cf, $index = null)
{
public function __construct(
$form_name, array $form, ConfigFile $cf, $index = null
) {
$this->index = $index;
$this->_configFile = $cf;
$this->loadForm($form_name, $form);

View File

@ -124,7 +124,9 @@ class FormDisplay
*/
public function registerForm($form_name, array $form, $server_id = null)
{
$this->_forms[$form_name] = new Form($form_name, $form, $this->_configFile, $server_id);
$this->_forms[$form_name] = new Form(
$form_name, $form, $this->_configFile, $server_id
);
$this->_isValidated = false;
foreach ($this->_forms[$form_name]->fields as $path) {
$work_path = $server_id === null
@ -182,7 +184,9 @@ class FormDisplay
}
// run validation
$errors = PMA_Validator::validate($this->_configFile, $paths, $values, false);
$errors = PMA_Validator::validate(
$this->_configFile, $paths, $values, false
);
// change error keys from canonical paths to work paths
if (is_array($errors) && count($errors) > 0) {

View File

@ -26,6 +26,7 @@ class PMA_Validator
* Returns validator list
*
* @param ConfigFile $cf Config file instance
*
* @return array
*/
public static function getValidators(ConfigFile $cf)
@ -49,7 +50,8 @@ class PMA_Validator
for ($i = 1; $i < count($uv); $i++) {
if (substr($uv[$i], 0, 6) == 'value:') {
$uv[$i] = PMA_arrayRead(
substr($uv[$i], 6), $GLOBALS['PMA_Config']->base_settings
substr($uv[$i], 6),
$GLOBALS['PMA_Config']->base_settings
);
}
}
@ -72,7 +74,7 @@ class PMA_Validator
* cleanup in HTML documen
* o false - when no validators match name(s) given by $validator_id
*
* @param ConfigFile $cf Config file instance
* @param ConfigFile $cf Config file instance
* @param string|array $validator_id ID of validator(s) to run
* @param array &$values Values to validate
* @param bool $isPostSource tells whether $values are directly from
@ -80,8 +82,9 @@ class PMA_Validator
*
* @return bool|array
*/
public static function validate(ConfigFile $cf, $validator_id, &$values, $isPostSource)
{
public static function validate(
ConfigFile $cf, $validator_id, &$values, $isPostSource
) {
// find validators
$validator_id = (array) $validator_id;
$validators = static::getValidators($cf);

View File

@ -659,8 +659,8 @@ function PMA_downloadHeader($filename, $mimetype, $length = 0, $no_cache = true)
* $path is a string describing position of an element in an associative array,
* eg. Servers/1/host refers to $array[Servers][1][host]
*
* @param string $path path in the arry
* @param array $array the array
* @param string $path path in the arry
* @param array $array the array
*
* @return mixed array element or $default
*/

View File

@ -379,22 +379,10 @@ class Node
*/
public function getPresence($type = '', $searchClause = '')
{
if (! $GLOBALS['cfg']['Servers'][$GLOBALS['server']]['DisableIS']) {
$query = "SELECT COUNT(*) ";
$query .= "FROM `INFORMATION_SCHEMA`.`SCHEMATA` ";
$query .= $this->_getWhereClause($searchClause);
$retval = (int)$GLOBALS['dbi']->fetchValue($query);
} else {
$query = "SHOW DATABASES ";
if (! empty($searchClause)) {
$query .= "LIKE '%";
$query .= PMA_Util::sqlAddSlashes(
$searchClause, true
);
$query .= "%' ";
}
$retval = $GLOBALS['dbi']->numRows($GLOBALS['dbi']->tryQuery($query));
}
$query = "SELECT COUNT(*) ";
$query .= "FROM `INFORMATION_SCHEMA`.`SCHEMATA` ";
$query .= $this->_getWhereClause($searchClause);
$retval = (int)$GLOBALS['dbi']->fetchValue($query);
return $retval;
}

View File

@ -13,6 +13,7 @@ if (! defined('PHPMYADMIN')) {
* Common initialization for user preferences modification pages
*
* @param ConfigFile $cf Config file instance
*
* @return void
*/
function PMA_userprefsPageInit(ConfigFile $cf)

View File

@ -45,7 +45,10 @@ if (PMA_ifSetOr($_POST['submit_clear'], '')) {
//
// Save generated config file on the server
//
file_put_contents($config_file_path, ConfigGenerator::getConfigFile($GLOBALS['ConfigFile']));
file_put_contents(
$config_file_path,
ConfigGenerator::getConfigFile($GLOBALS['ConfigFile'])
);
header('HTTP/1.1 303 See Other');
header('Location: index.php?action_done=config_saved');
exit;

View File

@ -17,11 +17,14 @@ class ConfigGenerator
* Creates config file
*
* @param ConfigFile $cf Config file instance
*
* @return string
*/
public static function getConfigFile(ConfigFile $cf)
{
$crlf = (isset($_SESSION['eol']) && $_SESSION['eol'] == 'win') ? "\r\n" : "\n";
$crlf = (isset($_SESSION['eol']) && $_SESSION['eol'] == 'win')
? "\r\n"
: "\n";
$c = $cf->getConfig();
// header
@ -38,7 +41,9 @@ class ConfigGenerator
if ($cf->getServerCount() > 0) {
$ret .= "/* Servers configuration */$crlf\$i = 0;" . $crlf . $crlf;
foreach ($c['Servers'] as $id => $server) {
$ret .= '/* Server: ' . strtr($cf->getServerName($id) . " [$id] ", '*/', '-') . "*/" . $crlf
$ret .= '/* Server: '
. strtr($cf->getServerName($id) . " [$id] ", '*/', '-')
. "*/" . $crlf
. '$i++;' . $crlf;
foreach ($server as $k => $v) {
$k = preg_replace('/[^A-Za-z0-9_]/', '_', $k);
@ -88,17 +93,20 @@ class ConfigGenerator
private static function _getVarExport($var_name, $var_value, $crlf)
{
if (!is_array($var_value) || empty($var_value)) {
return "\$cfg['$var_name'] = " . var_export($var_value, true) . ';' . $crlf;
return "\$cfg['$var_name'] = "
. var_export($var_value, true) . ';' . $crlf;
}
$ret = '';
if (self::_isZeroBasedArray($var_value)) {
$ret = "\$cfg['$var_name'] = " . self::_exportZeroBasedArray($var_value, $crlf)
$ret = "\$cfg['$var_name'] = "
. self::_exportZeroBasedArray($var_value, $crlf)
. ';' . $crlf;
} else {
// string keys: $cfg[key][subkey] = value
foreach ($var_value as $k => $v) {
$k = preg_replace('/[^A-Za-z0-9_]/', '_', $k);
$ret .= "\$cfg['$var_name']['$k'] = " . var_export($v, true) . ';' . $crlf;
$ret .= "\$cfg['$var_name']['$k'] = "
. var_export($v, true) . ';' . $crlf;
}
}
return $ret;

View File

@ -17,9 +17,9 @@ require_once __DIR__.'/selenium/PmaSeleniumCreateRemoveUserTest.php';
/**
* AllSeleniumTests class
*
*
* Runs all the selenium test cases
*
*
* @package PhpMyAdmin-test
* @subpackage Selenium
*/
@ -38,8 +38,8 @@ class AllSeleniumTests
/**
* Creates a SeleniumTestSuite and add all the selenium test cases to it
*
* @return PHPUnit_Extensions_SeleniumTestSuite
*
* @return PHPUnit_Extensions_SeleniumTestSuite
*/
public static function suite()
{

View File

@ -87,10 +87,10 @@ class Advisor_Test extends PHPUnit_Framework_TestCase
{
$result = ADVISOR_bytime(10, 2);
$this->assertEquals("10 per second", $result);
$result = ADVISOR_bytime(0.02, 2);
$this->assertEquals("1.2 per minute", $result);
$result = ADVISOR_bytime(0.003, 2);
$this->assertEquals("10.8 per hour", $result);
}
@ -104,7 +104,7 @@ class Advisor_Test extends PHPUnit_Framework_TestCase
{
$result = ADVISOR_timespanFormat(1200);
$this->assertEquals("0 days, 0 hours, 20 minutes and 0 seconds", $result);
$result = ADVISOR_timespanFormat(100);
$this->assertEquals("0 days, 0 hours, 1 minutes and 40 seconds", $result);
}

View File

@ -19,7 +19,7 @@ require_once 'libraries/relation.lib.php';
/**
* Tests for PMA_DBQbe class
*
*
* @package PhpMyAdmin-test
*/
class PMA_DBQbe_Test extends PHPUnit_Framework_TestCase

View File

@ -21,7 +21,7 @@ class PMA_File_Test extends PHPUnit_Framework_TestCase
{
/**
* Setup function for test cases
*
*
* @return void
*/
public function setup()
@ -34,10 +34,10 @@ class PMA_File_Test extends PHPUnit_Framework_TestCase
/**
* Test for PMA_File::getCompression
*
*
* @param string $file file string
* @param string $mime expected mime
*
*
* @return void
* @dataProvider compressedFiles
*/
@ -49,10 +49,10 @@ class PMA_File_Test extends PHPUnit_Framework_TestCase
/**
* Test for PMA_File::getNextChunk
*
*
* @param string $file file string
* @param string $mime expected mime
*
*
* @return void
* @dataProvider compressedFiles
*/
@ -71,10 +71,10 @@ class PMA_File_Test extends PHPUnit_Framework_TestCase
/**
* Test for PMA_File::getContent
*
*
* @param string $file file string
* @param string $mime expected mime
*
*
* @return void
* @dataProvider compressedFiles
*/
@ -87,7 +87,7 @@ class PMA_File_Test extends PHPUnit_Framework_TestCase
/**
* Data provider for tests
*
*
* @return array Test data
*/
public function compressedFiles()

View File

@ -22,7 +22,7 @@ class PMA_List_Database_Test extends PHPUnit_Framework_TestCase
{
/**
* SetUp for test cases
*
*
* @return void
*/
public function setup()
@ -49,7 +49,7 @@ class PMA_List_Database_Test extends PHPUnit_Framework_TestCase
/**
* Test for PMA_List_Database::getEmpty
*
*
* @return void
*/
public function testEmpty()
@ -60,7 +60,7 @@ class PMA_List_Database_Test extends PHPUnit_Framework_TestCase
/**
* Test for PMA_List_Database::getSingleItem
*
*
* @return void
*/
public function testSingle()
@ -71,7 +71,7 @@ class PMA_List_Database_Test extends PHPUnit_Framework_TestCase
/**
* Test for PMA_List_Database::exists
*
*
* @return void
*/
public function testExists()
@ -82,7 +82,7 @@ class PMA_List_Database_Test extends PHPUnit_Framework_TestCase
/**
* Test for PMA_List_Database::getHtmlOptions
*
*
* @return void
*/
public function testHtmlOptions()

View File

@ -330,7 +330,7 @@ class PMA_Message_Test extends PHPUnit_Framework_TestCase
/**
* Data provider for testDecodeBB
*
*
* @return array Test data
*/
public function decodeBBDataProvider()
@ -558,7 +558,7 @@ class PMA_Message_Test extends PHPUnit_Framework_TestCase
/**
* Data provider for testAffectedRows
*
*
* @return array Test-data
*/
public function providerAffectedRows()
@ -603,7 +603,7 @@ class PMA_Message_Test extends PHPUnit_Framework_TestCase
/**
* Data provider for testInsertedRows
*
*
* @return array Test-data
*/
public function providerInsertedRows()
@ -648,7 +648,7 @@ class PMA_Message_Test extends PHPUnit_Framework_TestCase
/**
* Data provider for testDeletedRows
*
*
* @return array Test-data
*/
public function providerDeletedRows()

View File

@ -24,7 +24,7 @@ class PMA_PDF_Test extends PHPUnit_Framework_TestCase
{
/**
* SetUp for test cases
*
*
* @return void
*/
public function setup()
@ -35,7 +35,7 @@ class PMA_PDF_Test extends PHPUnit_Framework_TestCase
/**
* Test for PMA_PDF::getPDFData
*
*
* @group large
* @return void
*/
@ -47,7 +47,7 @@ class PMA_PDF_Test extends PHPUnit_Framework_TestCase
/**
* Test for PMA_PDF::getPDFData
*
*
* @group large
* @return void
*/
@ -60,7 +60,7 @@ class PMA_PDF_Test extends PHPUnit_Framework_TestCase
/**
* Test for PMA_PDF::getPDFData
*
*
* @group large
* @return void
*/

View File

@ -146,8 +146,8 @@ $(function() {});
public function testGetFiles()
{
// codemirror's onload event is blacklisted
$this->object->addFile('codemirror/lib/codemirror.js');
$this->object->addFile('codemirror/lib/codemirror.js');
$this->object->addFile('common.js');
$this->assertEquals(
array(

View File

@ -494,7 +494,7 @@ class PMA_Table_Test extends PHPUnit_Framework_TestCase
$field_primary, $move_to
);
$this->assertEquals(
"`PMA_name` BIT(12) PMA_attribute NULL DEFAULT b'10' "
"`PMA_name` BIT(12) PMA_attribute NULL DEFAULT b'10' "
. "AUTO_INCREMENT COMMENT 'PMA_comment' FIRST",
$query
);
@ -507,7 +507,7 @@ class PMA_Table_Test extends PHPUnit_Framework_TestCase
$field_primary, $move_to
);
$this->assertEquals(
"`PMA_name` BOOLEAN PMA_attribute NULL DEFAULT TRUE "
"`PMA_name` BOOLEAN PMA_attribute NULL DEFAULT TRUE "
. "AUTO_INCREMENT COMMENT 'PMA_comment' FIRST",
$query
);
@ -520,7 +520,7 @@ class PMA_Table_Test extends PHPUnit_Framework_TestCase
$field_primary, $move_to
);
$this->assertEquals(
"`PMA_name` BOOLEAN PMA_attribute NULL DEFAULT NULL "
"`PMA_name` BOOLEAN PMA_attribute NULL DEFAULT NULL "
. "AUTO_INCREMENT COMMENT 'PMA_comment' FIRST",
$query
);
@ -533,7 +533,7 @@ class PMA_Table_Test extends PHPUnit_Framework_TestCase
$field_primary, $move_to
);
$this->assertEquals(
"`PMA_name` BOOLEAN PMA_attribute NULL DEFAULT CURRENT_TIMESTAMP "
"`PMA_name` BOOLEAN PMA_attribute NULL DEFAULT CURRENT_TIMESTAMP "
. "AUTO_INCREMENT COMMENT 'PMA_comment' FIRST",
$query
);
@ -548,7 +548,7 @@ class PMA_Table_Test extends PHPUnit_Framework_TestCase
$field_primary, $move_to
);
$this->assertEquals(
"`PMA_name` BOOLEAN PMA_attribute NULL INCREMENT "
"`PMA_name` BOOLEAN PMA_attribute NULL INCREMENT "
. "COMMENT 'PMA_comment' FIRST",
$query
);

View File

@ -26,7 +26,7 @@ class PMA_Theme_Manager_Test extends PHPUnit_Framework_TestCase
{
/**
* SetUp for test cases
*
*
* @return void
*/
public function setup()
@ -42,7 +42,7 @@ class PMA_Theme_Manager_Test extends PHPUnit_Framework_TestCase
/**
* Test for PMA_Theme_Manager::getThemeCookieName
*
*
* @return void
*/
public function testCookieName()
@ -53,7 +53,7 @@ class PMA_Theme_Manager_Test extends PHPUnit_Framework_TestCase
/**
* Test for PMA_Theme_Manager::getThemeCookieName
*
*
* @return void
*/
public function testPerServerCookieName()
@ -65,7 +65,7 @@ class PMA_Theme_Manager_Test extends PHPUnit_Framework_TestCase
/**
* Test for PMA_Theme_Manager::getHtmlSelectBox
*
*
* @return void
*/
public function testHtmlSelectBox()

View File

@ -55,7 +55,7 @@ class PMA_ThemeTest extends PHPUnit_Framework_TestCase
/**
* Test for PMA_Theme::loadInfo
*
*
* @return void
*/
public function testCheckImgPathNotExisted()
@ -66,7 +66,7 @@ class PMA_ThemeTest extends PHPUnit_Framework_TestCase
/**
* Test for PMA_Theme::loadInfo
*
*
* @return void
*/
public function testCheckImgPathIncorrect()
@ -80,7 +80,7 @@ class PMA_ThemeTest extends PHPUnit_Framework_TestCase
/**
* Test for PMA_Theme::getName, getVersion
*
*
* @return void
*/
public function testCheckImgPathFull()
@ -93,7 +93,7 @@ class PMA_ThemeTest extends PHPUnit_Framework_TestCase
/**
* Test for PMA_Theme::loadInfo
*
*
* @return void
*/
public function testLoadInfo()
@ -115,7 +115,7 @@ class PMA_ThemeTest extends PHPUnit_Framework_TestCase
/**
* Test for PMA_Theme::load
*
*
* @return void
*/
public function testLoad()
@ -126,7 +126,7 @@ class PMA_ThemeTest extends PHPUnit_Framework_TestCase
/**
* Test for PMA_Theme::load
*
*
* @return void
*/
public function testLoadNotExisted()
@ -136,7 +136,7 @@ class PMA_ThemeTest extends PHPUnit_Framework_TestCase
/**
* Test fir PMA_Theme::checkImgPath
*
*
* @return void
* @expectedException PHPUnit_Framework_Error
*/
@ -150,7 +150,7 @@ class PMA_ThemeTest extends PHPUnit_Framework_TestCase
/**
* Test for PMA_Theme::checkImgPath
*
*
* @return void
*/
public function testCheckImgPath()
@ -161,7 +161,7 @@ class PMA_ThemeTest extends PHPUnit_Framework_TestCase
/**
* Test for PMA_Theme::checkImgPath
*
*
* @return void
*/
public function testCheckImgPathGlobals()
@ -173,7 +173,7 @@ class PMA_ThemeTest extends PHPUnit_Framework_TestCase
/**
* Test for PMA_Theme::checkImgPath
*
*
* @return void
* @expectedException PHPUnit_Framework_Error
*/
@ -190,7 +190,7 @@ class PMA_ThemeTest extends PHPUnit_Framework_TestCase
/**
* Test for PMA_Theme::getPath
*
*
* @return void
*
* @covers PMA_Theme::setPath
@ -206,7 +206,7 @@ class PMA_ThemeTest extends PHPUnit_Framework_TestCase
/**
* Test for PMA_Theme::loadInfo
*
*
* @return void
*/
public function testGetLayoutFile()
@ -216,7 +216,7 @@ class PMA_ThemeTest extends PHPUnit_Framework_TestCase
/**
* Test for PMA_Theme::checkVersion
*
*
* @return void
*
* @depends testLoadInfo
@ -238,7 +238,7 @@ class PMA_ThemeTest extends PHPUnit_Framework_TestCase
/**
* Test for PMA_Theme::getName
*
*
* @return void
*
* @covers PMA_Theme::getName
@ -254,7 +254,7 @@ class PMA_ThemeTest extends PHPUnit_Framework_TestCase
/**
* Test for PMA_Theme::getId
*
*
* @return void
*
* @covers PMA_Theme::getId
@ -270,7 +270,7 @@ class PMA_ThemeTest extends PHPUnit_Framework_TestCase
/**
* Test for PMA_Theme::getImgPath
*
*
* @return void
*
* @covers PMA_Theme::getImgPath

View File

@ -29,7 +29,7 @@ class PMA_Types_Drizzle_Test extends PHPUnit_Framework_TestCase
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*
*
* @return void
*/
protected function setUp()
@ -56,7 +56,7 @@ class PMA_Types_Drizzle_Test extends PHPUnit_Framework_TestCase
/**
* Provider for testGetTypeDescription
*
*
* @return array
*/
public function providerForTestGetTypeDescription()
@ -162,7 +162,7 @@ class PMA_Types_Drizzle_Test extends PHPUnit_Framework_TestCase
/**
* Data provider
*
*
* @return array Test-data
*/
public function providerFortTestGetTypeClass()
@ -211,7 +211,7 @@ class PMA_Types_Drizzle_Test extends PHPUnit_Framework_TestCase
/**
* Provider for testGetFunctionsClass
*
*
* @return array
*/
public function providerFortTestGetFunctionsClass()
@ -332,7 +332,7 @@ class PMA_Types_Drizzle_Test extends PHPUnit_Framework_TestCase
/**
* Test for getAttributes
*
*
* @return void
*/
public function testGetAttributes()
@ -348,7 +348,7 @@ class PMA_Types_Drizzle_Test extends PHPUnit_Framework_TestCase
/**
* Test for getColumns
*
*
* @return void
*/
public function testGetColumns()

View File

@ -38,12 +38,14 @@ class PMA_Form_Test extends PHPUnit_Framework_TestCase
$GLOBALS['PMA_Config'] = new PMA_Config();
$GLOBALS['PMA_Config']->enableBc();
$GLOBALS['server'] = 0;
$this->object = new Form('pma_form_name', array('pma_form1','pma_form2'), new ConfigFile(), 1);
$this->object = new Form(
'pma_form_name', array('pma_form1','pma_form2'), new ConfigFile(), 1
);
}
/**
* tearDown for test cases
*
*
* @return void
*/
protected function tearDown()
@ -53,7 +55,7 @@ class PMA_Form_Test extends PHPUnit_Framework_TestCase
/**
* Test for Form::__constructor
*
*
* @return void
*/
public function testContructor()
@ -74,7 +76,7 @@ class PMA_Form_Test extends PHPUnit_Framework_TestCase
/**
* Test for Form::getOptionType
*
*
* @return void
*/
public function testGetOptionType()
@ -98,11 +100,11 @@ class PMA_Form_Test extends PHPUnit_Framework_TestCase
/**
* Test for Form::getOptionValueList
*
*
* @return void
*/
public function testGetOptionValueList()
{
{
$this->assertEquals(
array('NHibernate C# DO', 'NHibernate XML'),
$this->object->getOptionValueList("Export/codegen_format")
@ -110,8 +112,8 @@ class PMA_Form_Test extends PHPUnit_Framework_TestCase
$this->assertEquals(
array(
'auto' => 'auto',
'1' => 1,
'auto' => 'auto',
'1' => 1,
'0' => 0
),
$this->object->getOptionValueList("OBGzip")
@ -119,8 +121,8 @@ class PMA_Form_Test extends PHPUnit_Framework_TestCase
$this->assertEquals(
array(
'none' => 'Nowhere',
'left' => 'Left',
'none' => 'Nowhere',
'left' => 'Left',
'right' => 'Right',
'both' => "Both"
),
@ -130,7 +132,7 @@ class PMA_Form_Test extends PHPUnit_Framework_TestCase
/**
* Test for Form::_readFormPathsCallback
*
*
* @return void
*/
public function testReadFormPathsCallBack()
@ -182,7 +184,7 @@ class PMA_Form_Test extends PHPUnit_Framework_TestCase
/**
* Test for Form::readFormPaths
*
*
* @return void
*/
public function testReadFormPaths()
@ -228,7 +230,7 @@ class PMA_Form_Test extends PHPUnit_Framework_TestCase
preg_match("/^\:group\:end\:(\d+)$/", $key, $matches);
$digit = $matches[1];
$this->assertEquals(
"foo/bar/:group:end:" . $digit,
$result[':group:end:' . $digit]
@ -237,7 +239,7 @@ class PMA_Form_Test extends PHPUnit_Framework_TestCase
/**
* Test for Form::readTypes
*
*
* @return void
*/
public function testReadTypes()
@ -271,7 +273,7 @@ class PMA_Form_Test extends PHPUnit_Framework_TestCase
/**
* Test for Form::loadForm
*
*
* @return void
*/
public function testLoadForm()

View File

@ -284,7 +284,7 @@ class PMA_DBI_Drizzle_Test extends PHPUnit_Framework_TestCase
"numColumns",
$this->object->numFields($result)
);
}
}

View File

@ -139,15 +139,15 @@ class PMA_DBI_Mysql_Test extends PHPUnit_Framework_TestCase
'mysql_fetch_array',
$ret
);
//test for affectedRows
$link = "PMA_link";
$get_from_cache = false;
$get_from_cache = false;
$ret = $this->object->affectedRows($link, $get_from_cache);
$this->assertEquals(
"mysql_affected_rows",
$ret
);
);
//test for connect
$user = 'PMA_user';

View File

@ -20,7 +20,7 @@ class NodeFactory_Test extends PHPUnit_Framework_TestCase
{
/**
* SetUp for test cases
*
*
* @return void
*/
public function setup()
@ -32,7 +32,7 @@ class NodeFactory_Test extends PHPUnit_Framework_TestCase
/**
* Test for PMA_NodeFactory::getInstance
*
*
* @return void
*/
public function testDefaultNode()
@ -45,7 +45,7 @@ class NodeFactory_Test extends PHPUnit_Framework_TestCase
/**
* Test for PMA_NodeFactory::getInstance
*
*
* @return void
*/
public function testDefaultContainer()
@ -58,7 +58,7 @@ class NodeFactory_Test extends PHPUnit_Framework_TestCase
/**
* Test for PMA_NodeFactory::getInstance
*
*
* @return void
*/
public function testGroupContainer()
@ -73,7 +73,7 @@ class NodeFactory_Test extends PHPUnit_Framework_TestCase
/**
* Test for PMA_NodeFactory::getInstance
*
*
* @return void
*/
public function testFileError()
@ -84,7 +84,7 @@ class NodeFactory_Test extends PHPUnit_Framework_TestCase
/**
* Test for PMA_NodeFactory::getInstance
*
*
* @return void
*/
public function testClassNameError()

View File

@ -19,7 +19,7 @@ class Node_Column_Container_Test extends PHPUnit_Framework_TestCase
{
/**
* SetUp for test cases
*
*
* @return void
*/
public function setup()
@ -31,7 +31,7 @@ class Node_Column_Container_Test extends PHPUnit_Framework_TestCase
/**
* Test for PMA_NodeFactory::__construct
*
*
* @return void
*/
public function testConstructor()

View File

@ -19,7 +19,7 @@ class Node_Column_Test extends PHPUnit_Framework_TestCase
{
/**
* SetUp for test cases
*
*
* @return void
*/
public function setup()
@ -31,7 +31,7 @@ class Node_Column_Test extends PHPUnit_Framework_TestCase
/**
* Test for PMA_NodeFactory::getInstance
*
*
* @return void
*/
public function testConstructor()

View File

@ -19,7 +19,7 @@ class Node_Event_Container_Test extends PHPUnit_Framework_TestCase
{
/**
* SetUp for test cases
*
*
* @return void
*/
public function setup()
@ -31,7 +31,7 @@ class Node_Event_Container_Test extends PHPUnit_Framework_TestCase
/**
* Test for __construct
*
*
* @return void
*/
public function testConstructor()

View File

@ -19,7 +19,7 @@ class Node_Event_Test extends PHPUnit_Framework_TestCase
{
/**
* SetUp for test cases
*
*
* @return void
*/
public function setup()
@ -31,7 +31,7 @@ class Node_Event_Test extends PHPUnit_Framework_TestCase
/**
* Test for __construct
*
*
* @return void
*/
public function testConstructor()

View File

@ -19,7 +19,7 @@ class Node_Function_Container_Test extends PHPUnit_Framework_TestCase
{
/**
* SetUp for test cases
*
*
* @return void
*/
public function setup()
@ -31,7 +31,7 @@ class Node_Function_Container_Test extends PHPUnit_Framework_TestCase
/**
* Test for __construct
*
*
* @return void
*/
public function testConstructor()

View File

@ -19,7 +19,7 @@ class Node_Function_Test extends PHPUnit_Framework_TestCase
{
/**
* SetUp for test cases
*
*
* @return void
*/
public function setup()
@ -31,7 +31,7 @@ class Node_Function_Test extends PHPUnit_Framework_TestCase
/**
* Test for __construct
*
*
* @return void
*/
public function testConstructor()

View File

@ -19,7 +19,7 @@ class Node_Index_Container_Test extends PHPUnit_Framework_TestCase
{
/**
* SetUp for test cases
*
*
* @return void
*/
public function setup()
@ -31,7 +31,7 @@ class Node_Index_Container_Test extends PHPUnit_Framework_TestCase
/**
* Test for __construct
*
*
* @return void
*/
public function testConstructor()

View File

@ -19,7 +19,7 @@ class Node_Index_Test extends PHPUnit_Framework_TestCase
{
/**
* SetUp for test cases
*
*
* @return void
*/
public function setup()
@ -31,7 +31,7 @@ class Node_Index_Test extends PHPUnit_Framework_TestCase
/**
* Test for __construct
*
*
* @return void
*/
public function testConstructor()

View File

@ -19,7 +19,7 @@ class Node_Procedure_Container_Test extends PHPUnit_Framework_TestCase
{
/**
* SetUp for test cases
*
*
* @return void
*/
public function setup()
@ -31,7 +31,7 @@ class Node_Procedure_Container_Test extends PHPUnit_Framework_TestCase
/**
* Test for __construct
*
*
* @return void
*/
public function testConstructor()

View File

@ -19,7 +19,7 @@ class Node_Procedure_Test extends PHPUnit_Framework_TestCase
{
/**
* SetUp for test cases
*
*
* @return void
*/
public function setup()
@ -31,7 +31,7 @@ class Node_Procedure_Test extends PHPUnit_Framework_TestCase
/**
* Test for __construct
*
*
* @return void
*/
public function testConstructor()

View File

@ -19,7 +19,7 @@ class Node_Trigger_Container_Test extends PHPUnit_Framework_TestCase
{
/**
* SetUp for test cases
*
*
* @return void
*/
public function setup()

View File

@ -19,7 +19,7 @@ class Node_Trigger_Test extends PHPUnit_Framework_TestCase
{
/**
* SetUp for test cases
*
*
* @return void
*/
public function setup()

View File

@ -20,7 +20,7 @@ class Node_Test extends PHPUnit_Framework_TestCase
{
/**
* SetUp for test cases
*
*
* @return void
*/
public function setup()
@ -365,12 +365,12 @@ class Node_Test extends PHPUnit_Framework_TestCase
}
/**
* Tests the getPresence method when DisableIS is false
* Tests the getPresence method
*
* @return void
* @test
*/
public function testGetPresenceWithEnabledIS()
public function testGetPresence()
{
if (! isset($GLOBALS['cfg'])) {
$GLOBALS['cfg'] = array();
@ -381,14 +381,13 @@ class Node_Test extends PHPUnit_Framework_TestCase
if (! isset($GLOBALS['cfg']['Servers'][0])) {
$GLOBALS['cfg']['Servers'][0] = array();
}
$GLOBALS['cfg']['Servers'][0]['DisableIS'] = false;
$query = "SELECT COUNT(*) ";
$query .= "FROM `INFORMATION_SCHEMA`.`SCHEMATA` ";
$query .= "WHERE TRUE ";
// It would have been better to mock _getWhereClause method
// but stangely, mocking private methods is not supported in PHPUnit
// but strangely, mocking private methods is not supported in PHPUnit
$node = PMA_NodeFactory::getInstance();
$dbi = $this->getMockBuilder('PMA_DatabaseInterface')
@ -400,47 +399,5 @@ class Node_Test extends PHPUnit_Framework_TestCase
$GLOBALS['dbi'] = $dbi;
$node->getPresence();
}
/**
* Tests the getPresence method when DisableIS is true
*
* @return void
* @test
*/
public function testGetPresenceWithDisabledIS()
{
if (! isset($GLOBALS['cfg'])) {
$GLOBALS['cfg'] = array();
}
if (! isset($GLOBALS['cfg']['Servers'])) {
$GLOBALS['cfg']['Servers'] = array();
}
if (! isset($GLOBALS['cfg']['Servers'][0])) {
$GLOBALS['cfg']['Servers'][0] = array();
}
$GLOBALS['cfg']['Servers'][0]['DisableIS'] = true;
$node = PMA_NodeFactory::getInstance();
// test with no search clause
$dbi = $this->getMockBuilder('PMA_DatabaseInterface')
->disableOriginalConstructor()
->getMock();
$dbi->expects($this->once())
->method('tryQuery')
->with("SHOW DATABASES ");
$GLOBALS['dbi'] = $dbi;
$node->getPresence();
// test with a search clause
$dbi = $this->getMockBuilder('PMA_DatabaseInterface')
->disableOriginalConstructor()
->getMock();
$dbi->expects($this->once())
->method('tryQuery')
->with("SHOW DATABASES LIKE '%dbname%' ");
$GLOBALS['dbi'] = $dbi;
$node->getPresence('', 'dbname');
}
}
?>

View File

@ -13,16 +13,16 @@ require_once 'libraries/config.default.php';
/**
* Dummy testObserver
*
*
* @package PhpMyAdmin-test
*/
class PMA_TestObserver implements SplObserver
{
/**
* udpate
*
*
* @param SplSubject $subject subject for observer
*
*
* @return null
*/
public function update(SplSubject $subject)
@ -51,16 +51,16 @@ class PMA_PluginManager_Test extends PHPUnit_Framework_TestCase
$GLOBALS['PMA_Config'] = new PMA_Config();
$GLOBALS['PMA_Config']->enableBc();
$GLOBALS['server'] = 0;
$this->object = new PluginManager(null);
$this->attrStorage = new \ReflectionProperty('PluginManager', '_storage');
$this->attrStorage->setAccessible(true);
}
/**
* tearDown for test cases
*
*
* @return void
*/
public function tearDown()
@ -70,7 +70,7 @@ class PMA_PluginManager_Test extends PHPUnit_Framework_TestCase
/**
* Test for PluginManager::__construct
*
*
* @return void
*/
public function testConstructor()
@ -83,7 +83,7 @@ class PMA_PluginManager_Test extends PHPUnit_Framework_TestCase
/**
* Test for PluginManager::attach
*
*
* @return void
*/
public function testAttach()
@ -107,7 +107,7 @@ class PMA_PluginManager_Test extends PHPUnit_Framework_TestCase
/**
* Test for PluginManager::detach
*
*
* @return void
*/
public function testDetach()
@ -132,13 +132,13 @@ class PMA_PluginManager_Test extends PHPUnit_Framework_TestCase
* Test for
* - PluginManager::getStorage
* - PluginManager::setStorage
*
*
* @return void
*/
public function testSetGetStorage()
{
$s = new SplObjectStorage();
$o1 = new StdClass;
$o1 = new StdClass;
$s[$o1] = 'testData';
$this->object->setStorage($s);
@ -153,7 +153,7 @@ class PMA_PluginManager_Test extends PHPUnit_Framework_TestCase
* Test for
* - PluginManager::getStatus
* - PluginManager::setStatus
*
*
* @return void
*/
public function testSetGetStatus()

View File

@ -37,7 +37,7 @@ class PMA_AuthenticationConfig_Test extends PHPUnit_Framework_TestCase
/**
* tearDown for test cases
*
*
* @return void
*/
public function tearDown()
@ -47,7 +47,7 @@ class PMA_AuthenticationConfig_Test extends PHPUnit_Framework_TestCase
/**
* Test for AuthenticationConfig::auth
*
*
* @return void
*/
public function testAuth()
@ -59,7 +59,7 @@ class PMA_AuthenticationConfig_Test extends PHPUnit_Framework_TestCase
/**
* Test for AuthenticationConfig::authCheck
*
*
* @return void
*/
public function testAuthCheck()
@ -71,7 +71,7 @@ class PMA_AuthenticationConfig_Test extends PHPUnit_Framework_TestCase
/**
* Test for AuthenticationConfig::authSetUser
*
*
* @return void
*/
public function testAuthSetUser()
@ -83,7 +83,7 @@ class PMA_AuthenticationConfig_Test extends PHPUnit_Framework_TestCase
/**
* Test for AuthenticationConfig::authFails
*
*
* @return void
*/
public function testAuthFails()
@ -94,7 +94,7 @@ class PMA_AuthenticationConfig_Test extends PHPUnit_Framework_TestCase
$GLOBALS['allowDeny_forbidden'] = false;
if (!defined('PMA_USR_BROWSER_AGENT')) {
define('PMA_USR_BROWSER_AGENT', 'chrome');
$removeConstant = true;
if (! PMA_HAS_RUNKIT) {

View File

@ -903,7 +903,8 @@ class PMA_AuthenticationCookie_Test extends PHPUnit_Framework_TestCase
isset($_COOKIE['pmaServer-2'])
);
// target can be "phpunit" or "ide-phpunut.php", depending on testing environment
// target can be "phpunit" or "ide-phpunut.php",
// depending on testing environment
$this->assertStringStartsWith(
'Location: http://phpmyadmin.net/index.php?target=',
$GLOBALS['header'][0]

View File

@ -39,7 +39,7 @@ class PMA_AuthenticationSignon_Test extends PHPUnit_Framework_TestCase
/**
* tearDown for test cases
*
*
* @return void
*/
public function tearDown()
@ -49,7 +49,7 @@ class PMA_AuthenticationSignon_Test extends PHPUnit_Framework_TestCase
/**
* Test for AuthenticationSignon::auth
*
*
* @return void
*/
public function testAuth()
@ -103,7 +103,7 @@ class PMA_AuthenticationSignon_Test extends PHPUnit_Framework_TestCase
/**
* Test for AuthenticationSignon::authCheck
*
*
* @return void
*/
public function testAuthCheck()
@ -125,7 +125,7 @@ class PMA_AuthenticationSignon_Test extends PHPUnit_Framework_TestCase
$GLOBALS['cfg']['Server']['host'] = 'localhost';
$GLOBALS['cfg']['Server']['port'] = '80';
$GLOBALS['cfg']['Server']['user'] = 'user';
$this->assertTrue(
$this->object->authCheck()
);
@ -215,7 +215,7 @@ class PMA_AuthenticationSignon_Test extends PHPUnit_Framework_TestCase
/**
* Test for AuthenticationSignon::authSetUser
*
*
* @return void
*/
public function testAuthSetUser()
@ -240,7 +240,7 @@ class PMA_AuthenticationSignon_Test extends PHPUnit_Framework_TestCase
/**
* Test for AuthenticationSignon::authFails
*
*
* @return void
*/
public function testAuthFails()
@ -259,7 +259,7 @@ class PMA_AuthenticationSignon_Test extends PHPUnit_Framework_TestCase
// case 1
$GLOBALS['login_without_password_is_forbidden'] = true;
$this->object->authFails();
$this->assertEquals(
@ -272,7 +272,7 @@ class PMA_AuthenticationSignon_Test extends PHPUnit_Framework_TestCase
$GLOBALS['login_without_password_is_forbidden'] = null;
$GLOBALS['allowDeny_forbidden'] = true;
$this->object->authFails();
$this->assertEquals(

View File

@ -34,7 +34,7 @@ class PMA_ExportExcel_Test extends PHPUnit_Framework_TestCase
/**
* tearDown for test cases
*
*
* @return void
*/
public function tearDown()
@ -44,7 +44,7 @@ class PMA_ExportExcel_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportExcel::setProperties
*
*
* @return void
*/
public function testSetProperties()
@ -115,7 +115,7 @@ class PMA_ExportExcel_Test extends PHPUnit_Framework_TestCase
'TextPropertyItem',
$property
);
$this->assertEquals(
'null',
$property->getName()
@ -132,7 +132,7 @@ class PMA_ExportExcel_Test extends PHPUnit_Framework_TestCase
'BoolPropertyItem',
$property
);
$this->assertEquals(
'removeCRLF',
$property->getName()
@ -149,7 +149,7 @@ class PMA_ExportExcel_Test extends PHPUnit_Framework_TestCase
'BoolPropertyItem',
$property
);
$this->assertEquals(
'columns',
$property->getName()
@ -166,7 +166,7 @@ class PMA_ExportExcel_Test extends PHPUnit_Framework_TestCase
'SelectPropertyItem',
$property
);
$this->assertEquals(
'edition',
$property->getName()
@ -192,7 +192,7 @@ class PMA_ExportExcel_Test extends PHPUnit_Framework_TestCase
'HiddenPropertyItem',
$property
);
$this->assertEquals(
'structure_or_data',
$property->getName()

View File

@ -42,7 +42,7 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
/**
* tearDown for test cases
*
*
* @return void
*/
public function tearDown()
@ -52,7 +52,7 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportSql::setProperties
*
*
* @return void
*/
public function testSetProperties()
@ -71,7 +71,7 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
}
if (PMA_MYSQL_INT_VERSION <= 50100) {
$restoreMySQLIntVersion = PMA_MYSQL_INT_VERSION;
runkit_constant_redefine('PMA_MYSQL_INT_VERSION', 50111);
runkit_constant_redefine('PMA_MYSQL_INT_VERSION', 50111);
}
}
}
@ -261,7 +261,7 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
);
$this->assertEquals(
'Add <code>DROP TABLE / VIEW / PROCEDURE / FUNCTION</code>' .
'Add <code>DROP TABLE / VIEW / PROCEDURE / FUNCTION</code>' .
'<code> / EVENT</code> statement',
$leaf->getText()
);
@ -326,13 +326,13 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportSql::setProperties
*
*
* @return void
*/
public function testSetPropertiesWithDrizzle()
{
$restoreDrizzle = $restoreMySQLIntVersion = 'PMANORESTORE';
if (!PMA_DRIZZLE || PMA_MYSQL_INT_VERSION > 50100) {
if (!PMA_HAS_RUNKIT) {
$this->markTestSkipped(
@ -345,7 +345,7 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
}
if (PMA_MYSQL_INT_VERSION > 50100) {
$restoreMySQLIntVersion = PMA_MYSQL_INT_VERSION;
runkit_constant_redefine('PMA_MYSQL_INT_VERSION', 50000);
runkit_constant_redefine('PMA_MYSQL_INT_VERSION', 50000);
}
}
}
@ -364,9 +364,9 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
$properties = $attrProperties->getValue($this->object);
$options = $properties->getOptions();
$generalOptionsArray = $options->getProperties();
$this->assertCount(
3,
$generalOptionsArray
@ -435,7 +435,7 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
$structOption = $generalOptionsArray[1];
$properties = $structOption->getProperties();
$subgroupProps = $properties[0]->getProperties();
$this->assertContains(
'<code>DROP TABLE</code>',
$subgroupProps[0]->getText()
@ -454,7 +454,7 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportSql::exportRoutines
*
*
* @return void
*/
public function testExportRoutines()
@ -504,14 +504,14 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportSql::_exportComment
*
*
* @return void
*/
public function testExportComment()
{
$method = new ReflectionMethod('ExportSql', '_exportComment');
$method->setAccessible(true);
$GLOBALS['crlf'] = '##';
$GLOBALS['sql_include_comments'] = true;
@ -526,7 +526,7 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
);
$GLOBALS['sql_include_comments'] = false;
$this->assertEquals(
'',
$method->invoke($this->object, 'Comment')
@ -542,14 +542,14 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportSql::_possibleCRLF
*
*
* @return void
*/
public function testPossibleCRLF()
{
$method = new ReflectionMethod('ExportSql', '_possibleCRLF');
$method->setAccessible(true);
$GLOBALS['crlf'] = '##';
$GLOBALS['sql_include_comments'] = true;
@ -564,7 +564,7 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
);
$GLOBALS['sql_include_comments'] = false;
$this->assertEquals(
'',
$method->invoke($this->object, 'Comment')
@ -580,7 +580,7 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportSql::exportFooter
*
*
* @return void
*/
public function testExportFooter()
@ -614,7 +614,7 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
$dbi->expects($this->once())
->method('query')
->with('SET time_zone = "GMT"');
$GLOBALS['dbi'] = $dbi;
$this->expectOutputString(
@ -636,7 +636,7 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportSql::exportHeader
*
*
* @return void
*/
public function testExportHeader()
@ -686,7 +686,7 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
$dbi->expects($this->once())
->method('query')
->with('SET time_zone = "+00:00"');
$GLOBALS['dbi'] = $dbi;
ob_start();
@ -704,12 +704,12 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
'h2C',
$result
);
$this->assertContains(
"SET FOREIGN_KEY_CHECKS=0;\n",
$result
);
$this->assertContains(
"40101 SET",
$result
@ -719,7 +719,7 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
"SET FOREIGN_KEY_CHECKS=0;\n" .
"SET SQL_MODE = \"NO_AUTO_VALUE_ON_ZERO\";\n" .
"SET AUTOCOMMIT = 0;\n" .
"START TRANSACTION;\n" .
"START TRANSACTION;\n" .
"SET time_zone = \"+00:00\";\n",
$result
);
@ -732,7 +732,7 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportSql::exportDBCreate
*
*
* @return void
*/
public function testExportDBCreate()
@ -816,7 +816,7 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportSql::exportDBHeader
*
*
* @return void
*/
public function testExportDBHeader()
@ -825,7 +825,7 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
$GLOBALS['sql_backquotes'] = '';
$GLOBALS['sql_include_comments'] = true;
$GLOBALS['crlf'] = "\n";
ob_start();
$this->assertTrue(
$this->object->exportDBHeader('testDB')
@ -840,7 +840,7 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
// case 2
unset($GLOBALS['sql_compatibility']);
unset($GLOBALS['sql_backquotes']);
ob_start();
$this->assertTrue(
$this->object->exportDBHeader('testDB')
@ -855,7 +855,7 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportSql::exportDBFooter
*
*
* @return void
*/
public function testExportDBFooterWithNewerMySQLVersion()
@ -940,7 +940,7 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportSql::exportDBFooter
*
*
* @return void
*/
public function testExportDBFooterWithOlderMySQLVersion()
@ -987,7 +987,7 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportSql::getTableDefStandIn
*
*
* @return void
*/
public function testGetTableDefStandIn()
@ -1025,7 +1025,7 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportSql::_getTableDefForView
*
*
* @return void
*/
public function testGetTableDefForView()
@ -1105,7 +1105,7 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportSql::getTableDef
*
*
* @return void
*/
public function testGetTableDefWithoutDrizzle()
@ -1189,7 +1189,7 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
"CREATE TABLE `db`.`table`,\n CONSTRAINT KEYS \nFOREIGN KEY\n) " .
"unsigned NOT NULL\n(\r\n"
);
$dbi->expects($this->once())
->method('fetchRow')
->with('res')
@ -1241,7 +1241,7 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
'-- Constraints for table "table"',
$GLOBALS['sql_constraints']
);
$this->assertContains(
'ALTER TABLE "table"' . "\n",
$GLOBALS['sql_constraints']
@ -1271,7 +1271,7 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
'ALTER TABLE "db"."table"' . "\n",
$GLOBALS['sql_drop_foreign_keys']
);
$this->assertContains(
'DROP FOREIGN KEY KEYS',
$GLOBALS['sql_drop_foreign_keys']
@ -1284,7 +1284,7 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportSql::getTableDef
*
*
* @return void
*/
public function testGetTableDefWithDrizzle()
@ -1366,7 +1366,7 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
"CREATE TABLE `db`.`table` ROW_FORMAT='row',\n CONSTRAINT "
. "KEYS \nFOREIGN KEY\n) unsigned NOT NULL\n(\r"
);
$dbi->expects($this->once())
->method('fetchRow')
->with('res')
@ -1398,7 +1398,7 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
'-- Constraints for table',
$GLOBALS['sql_constraints']
);
$this->assertNotContains(
'-- Constraints for table "table"',
$GLOBALS['sql_constraints']
@ -1411,7 +1411,7 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportSql::getTableDef
*
*
* @return void
*/
public function testGetTableDefWithError()
@ -1514,7 +1514,7 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportSql::_getTableComments
*
*
* @return void
*/
public function testGetTableComments()
@ -1585,12 +1585,12 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportSql::exportStructure
*
*
* @return void
*/
public function testExportStructure()
{
$dbi = $this->getMockBuilder('PMA_DatabaseInterface')
->disableOriginalConstructor()
->getMock();
@ -1651,7 +1651,7 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
'dumpText1',
$result
);
// case 2
unset($GLOBALS['sql_compatibility']);
unset($GLOBALS['sql_backquotes']);
@ -1747,7 +1747,7 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportSql::exportData
*
*
* @return void
*/
public function testExportData()
@ -1879,7 +1879,7 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportSql::exportData
*
*
* @return void
*/
public function testExportDataWithUpdate()
@ -1973,7 +1973,7 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportSql::exportData
*
*
* @return void
*/
public function testExportDataWithIsView()
@ -2011,7 +2011,7 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportSql::exportData
*
*
* @return void
*/
public function testExportDataWithError()
@ -2044,12 +2044,12 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportSql::_makeCreateTableMSSQLCompatible
*
*
* @return void
*/
public function testMakeCreateTableMSSQLCompatible()
{
$query = "CREATE TABLE IF NOT EXISTS (\" date DEFAULT NULL,\n" .
"\" date DEFAULT NULL\n\" date NOT NULL,\n\" date NOT NULL\n," .
" \" date NOT NULL DEFAULT 'asd'," .
@ -2066,7 +2066,7 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
" \" float(22,2,) NOT NULL,\n" .
" \" double NOT NULL\n" .
" \" double NOT NULL DEFAULT '213'\n";
$method = new ReflectionMethod(
'ExportSql', '_makeCreateTableMSSQLCompatible'
);

View File

@ -42,7 +42,7 @@ class PMA_ExportTexytext_Test extends PHPUnit_Framework_TestCase
/**
* tearDown for test cases
*
*
* @return void
*/
public function tearDown()
@ -52,7 +52,7 @@ class PMA_ExportTexytext_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportTexytext::setProperties
*
*
* @return void
*/
public function testSetProperties()
@ -124,7 +124,7 @@ class PMA_ExportTexytext_Test extends PHPUnit_Framework_TestCase
'RadioPropertyItem',
$property
);
$generalOptions = array_shift($generalOptionsArray);
$this->assertInstanceOf(
@ -145,7 +145,7 @@ class PMA_ExportTexytext_Test extends PHPUnit_Framework_TestCase
'BoolPropertyItem',
$property
);
$this->assertEquals(
'columns',
$property->getName()
@ -157,7 +157,7 @@ class PMA_ExportTexytext_Test extends PHPUnit_Framework_TestCase
'TextPropertyItem',
$property
);
$this->assertEquals(
'null',
$property->getName()
@ -166,7 +166,7 @@ class PMA_ExportTexytext_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportTexytext::exportHeader
*
*
* @return void
*/
public function testExportHeader()
@ -178,7 +178,7 @@ class PMA_ExportTexytext_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportTexytext::exportFooter
*
*
* @return void
*/
public function testExportFooter()
@ -190,7 +190,7 @@ class PMA_ExportTexytext_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportTexytext::exportDBHeader
*
*
* @return void
*/
public function testExportDBHeader()
@ -205,7 +205,7 @@ class PMA_ExportTexytext_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportTexytext::exportDBFooter
*
*
* @return void
*/
public function testExportDBFooter()
@ -217,7 +217,7 @@ class PMA_ExportTexytext_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportTexytext::exportDBCreate
*
*
* @return void
*/
public function testExportDBCreate()
@ -229,7 +229,7 @@ class PMA_ExportTexytext_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportTexytext::exportData
*
*
* @return void
*/
public function testExportData()
@ -287,12 +287,12 @@ class PMA_ExportTexytext_Test extends PHPUnit_Framework_TestCase
"|&amp;gt;|0|test",
$result
);
}
/**
* Test for ExportTexytext::getTableDefStandIn
*
*
* @return void
*/
public function testGetTableDefStandIn()
@ -353,7 +353,7 @@ class PMA_ExportTexytext_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportTexytext::getTableDef
*
*
* @return void
*/
public function testGetTableDef()
@ -419,7 +419,7 @@ class PMA_ExportTexytext_Test extends PHPUnit_Framework_TestCase
)
);
$columns = array(
'Field' => 'fname',
'Comment' => 'comm'
@ -429,7 +429,7 @@ class PMA_ExportTexytext_Test extends PHPUnit_Framework_TestCase
->method('getColumns')
->with('db', 'table')
->will($this->returnValue(array($columns)));
$GLOBALS['dbi'] = $dbi;
$this->object->expects($this->exactly(1))
@ -465,7 +465,7 @@ class PMA_ExportTexytext_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportTexytext::getTriggers
*
*
* @return void
*/
public function testGetTriggers()
@ -482,7 +482,7 @@ class PMA_ExportTexytext_Test extends PHPUnit_Framework_TestCase
'definition' => 'def'
)
);
$dbi->expects($this->once())
->method('getTriggers')
->with('database', 'ta<ble')
@ -506,12 +506,12 @@ class PMA_ExportTexytext_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportTexytext::exportStructure
*
*
* @return void
*/
public function testExportStructure()
{
$dbi = $this->getMockBuilder('PMA_DatabaseInterface')
->disableOriginalConstructor()
->getMock();
@ -549,7 +549,7 @@ class PMA_ExportTexytext_Test extends PHPUnit_Framework_TestCase
->will($this->returnValue('dumpText4'));
$GLOBALS['dbi'] = $dbi;
// case 1
ob_start();
$this->assertTrue(
@ -609,7 +609,7 @@ class PMA_ExportTexytext_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportTexytext::formatOneColumnDefinition
*
*
* @return void
*/
public function testFormatOneColumnDefinition()

View File

@ -43,7 +43,7 @@ class PMA_ExportXml_Test extends PHPUnit_Framework_TestCase
/**
* tearDown for test cases
*
*
* @return void
*/
public function tearDown()
@ -53,7 +53,7 @@ class PMA_ExportXml_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportXml::setProperties
*
*
* @return void
*/
public function testSetProperties()
@ -133,7 +133,7 @@ class PMA_ExportXml_Test extends PHPUnit_Framework_TestCase
'HiddenPropertyItem',
$property
);
$generalOptions = array_shift($generalOptionsArray);
$this->assertInstanceOf(
@ -194,7 +194,7 @@ class PMA_ExportXml_Test extends PHPUnit_Framework_TestCase
'data',
$generalOptions->getName()
);
$generalProperties = $generalOptions->getProperties();
$property = array_shift($generalProperties);
@ -203,7 +203,7 @@ class PMA_ExportXml_Test extends PHPUnit_Framework_TestCase
'BoolPropertyItem',
$property
);
if ($restoreDrizzle !== "PMANORESTORE") {
runkit_constant_redefine('PMA_DRIZZLE', $restoreDrizzle);
}
@ -211,7 +211,7 @@ class PMA_ExportXml_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportXml::exportHeader
*
*
* @return void
*/
public function testExportHeaderWithoutDrizzle()
@ -447,7 +447,7 @@ class PMA_ExportXml_Test extends PHPUnit_Framework_TestCase
'&lt;pma:structure_schemas&gt;' . "\n" .
' &lt;pma:database name=&quot;d&amp;lt;&amp;quot;b&quot; collat' .
'ion=&quot;utf8_general_ci&quot; charset=&quot;utf-8&quot;&gt;' . "\n" .
' &lt;/pma:database&gt;' . "\n" .
' &lt;/pma:database&gt;' . "\n" .
' &lt;/pma:structure_schemas&gt;',
$result
);
@ -459,7 +459,7 @@ class PMA_ExportXml_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportXml::exportHeader
*
*
* @return void
*/
public function testExportHeaderWithDrizzle()
@ -521,7 +521,7 @@ class PMA_ExportXml_Test extends PHPUnit_Framework_TestCase
->method('fetchResult')
->will($this->returnValue(false));
$GLOBALS['dbi'] = $dbi;
$GLOBALS['tables'] = array();
@ -540,7 +540,7 @@ class PMA_ExportXml_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportXml::exportFooter
*
*
* @return void
*/
public function testExportFooter()
@ -555,7 +555,7 @@ class PMA_ExportXml_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportXml::exportDBHeader
*
*
* @return void
*/
public function testExportDBHeader()
@ -582,7 +582,7 @@ class PMA_ExportXml_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportXml::exportDBFooter
*
*
* @return void
*/
public function testExportDBFooter()
@ -609,7 +609,7 @@ class PMA_ExportXml_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportXml::exportDBCreate
*
*
* @return void
*/
public function testExportDBCreate()
@ -621,7 +621,7 @@ class PMA_ExportXml_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportXml::exportData
*
*
* @return void
*/
public function testExportData()
@ -678,23 +678,23 @@ class PMA_ExportXml_Test extends PHPUnit_Framework_TestCase
"&lt;table name=&quot;ta&amp;lt;ble&quot;&gt;",
$result
);
$this->assertContains(
"&lt;column name=&quot;fName1&quot;&gt;NULL&lt;/column&gt;",
$result
);
$this->assertContains(
"&lt;column name=&quot;fNa&amp;quot;me2&quot;&gt;&amp;lt;a&amp;gt;" .
"&lt;/column&gt;",
$result
);
$this->assertContains(
"&lt;column name=&quot;fName3&quot;&gt;NULL&lt;/column&gt;",
$result
);
$this->assertContains(
"&lt;/table&gt;",
$result

View File

@ -40,7 +40,7 @@ class PMA_ExportYaml_Test extends PHPUnit_Framework_TestCase
/**
* tearDown for test cases
*
*
* @return void
*/
public function tearDown()
@ -50,7 +50,7 @@ class PMA_ExportYaml_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportYaml::setProperties
*
*
* @return void
*/
public function testSetProperties()
@ -121,7 +121,7 @@ class PMA_ExportYaml_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportYaml::exportHeader
*
*
* @return void
*/
public function testExportHeader()
@ -140,7 +140,7 @@ class PMA_ExportYaml_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportYaml::exportFooter
*
*
* @return void
*/
public function testExportFooter()
@ -155,7 +155,7 @@ class PMA_ExportYaml_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportYaml::exportDBHeader
*
*
* @return void
*/
public function testExportDBHeader()
@ -167,7 +167,7 @@ class PMA_ExportYaml_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportYaml::exportDBFooter
*
*
* @return void
*/
public function testExportDBFooter()
@ -179,7 +179,7 @@ class PMA_ExportYaml_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportYaml::exportDBCreate
*
*
* @return void
*/
public function testExportDBCreate()
@ -191,7 +191,7 @@ class PMA_ExportYaml_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportYaml::exportData
*
*
* @return void
*/
public function testExportData()

View File

@ -35,7 +35,7 @@ class PMA_TableProperty_Test extends PHPUnit_Framework_TestCase
/**
* tearDown for test cases
*
*
* @return void
*/
public function tearDown()
@ -83,7 +83,7 @@ class PMA_TableProperty_Test extends PHPUnit_Framework_TestCase
/**
* Test for TableProperty::getPureType
*
*
* @return void
*/
public function testGetPureType()
@ -105,10 +105,10 @@ class PMA_TableProperty_Test extends PHPUnit_Framework_TestCase
/**
* Test for TableProperty::isNotNull
*
*
* @param string $nullable nullable value
* @param string $expected expected output
*
*
* @return void
* @dataProvider isNotNullProvider
*/
@ -124,7 +124,7 @@ class PMA_TableProperty_Test extends PHPUnit_Framework_TestCase
/**
* Data provider for testIsNotNull
*
*
* @return array Test Data
*/
public function isNotNullProvider()
@ -138,10 +138,10 @@ class PMA_TableProperty_Test extends PHPUnit_Framework_TestCase
/**
* Test for TableProperty::isUnique
*
*
* @param string $key key value
* @param string $expected expected output
*
*
* @return void
* @dataProvider isUniqueProvider
*/
@ -157,7 +157,7 @@ class PMA_TableProperty_Test extends PHPUnit_Framework_TestCase
/**
* Data provider for testIsUnique
*
*
* @return array Test Data
*/
public function isUniqueProvider()
@ -173,10 +173,10 @@ class PMA_TableProperty_Test extends PHPUnit_Framework_TestCase
/**
* Test for TableProperty::getDotNetPrimitiveType
*
*
* @param string $type type value
* @param string $expected expected output
*
*
* @return void
* @dataProvider getDotNetPrimitiveTypeProvider
*/
@ -192,7 +192,7 @@ class PMA_TableProperty_Test extends PHPUnit_Framework_TestCase
/**
* Data provider for testGetDotNetPrimitiveType
*
*
* @return array Test Data
*/
public function getDotNetPrimitiveTypeProvider()
@ -214,10 +214,10 @@ class PMA_TableProperty_Test extends PHPUnit_Framework_TestCase
/**
* Test for TableProperty::getDotNetObjectType
*
*
* @param string $type type value
* @param string $expected expected output
*
*
* @return void
* @dataProvider getDotNetObjectTypeProvider
*/
@ -233,7 +233,7 @@ class PMA_TableProperty_Test extends PHPUnit_Framework_TestCase
/**
* Data provider for testGetDotNetObjectType
*
*
* @return array Test Data
*/
public function getDotNetObjectTypeProvider()
@ -255,7 +255,7 @@ class PMA_TableProperty_Test extends PHPUnit_Framework_TestCase
/**
* Test for TableProperty::getIndexName
*
*
* @return void
*/
public function testGetIndexName()
@ -278,7 +278,7 @@ class PMA_TableProperty_Test extends PHPUnit_Framework_TestCase
/**
* Test for TableProperty::isPK
*
*
* @return void
*/
public function testIsPK()
@ -298,7 +298,7 @@ class PMA_TableProperty_Test extends PHPUnit_Framework_TestCase
/**
* Test for TableProperty::formatCs
*
*
* @return void
*/
public function testFormatCs()
@ -313,7 +313,7 @@ class PMA_TableProperty_Test extends PHPUnit_Framework_TestCase
/**
* Test for TableProperty::formatXml
*
*
* @return void
*/
public function testFormatXml()
@ -328,7 +328,7 @@ class PMA_TableProperty_Test extends PHPUnit_Framework_TestCase
/**
* Test for TableProperty::format
*
*
* @return void
*/
public function testFormat()

View File

@ -50,17 +50,17 @@ class ImportMediawiki_Test extends PHPUnit_Framework_TestCase
$GLOBALS['plugin_param'] = 'database';
$this->object = new ImportMediawiki();
//setting
//setting
$GLOBALS['finished'] = false;
$GLOBALS['read_limit'] = 100000000;
$GLOBALS['offset'] = 0;
$GLOBALS['cfg']['Server']['DisableIS'] = false;
$GLOBALS['cfg']['ServerDefault'] = 0;
$GLOBALS['cfg']['AllowUserDropDatabase'] = false;
$GLOBALS['import_file'] = 'test/test_data/phpmyadmin.mediawiki';
$GLOBALS['import_text'] = 'ImportMediawiki_Test';
$GLOBALS['compression'] = 'none';
$GLOBALS['compression'] = 'none';
$GLOBALS['read_multiply'] = 10;
$GLOBALS['import_type'] = 'Mediawiki';
$GLOBALS['import_handle'] = @fopen($GLOBALS['import_file'], 'r');
@ -77,7 +77,7 @@ class ImportMediawiki_Test extends PHPUnit_Framework_TestCase
{
unset($this->object);
}
/**
* Test for getProperties
*
@ -91,26 +91,26 @@ class ImportMediawiki_Test extends PHPUnit_Framework_TestCase
$this->assertEquals(
__('MediaWiki Table'),
$properties->getText()
);
);
$this->assertEquals(
'txt',
$properties->getExtension()
);
);
$this->assertEquals(
'text/plain',
$properties->getMimeType()
);
);
$this->assertEquals(
array(),
$properties->getOptions()
);
);
$this->assertEquals(
__('Options'),
$properties->getOptionsText()
);
);
}
/**
* Test for doImport
*
@ -121,22 +121,22 @@ class ImportMediawiki_Test extends PHPUnit_Framework_TestCase
public function testDoImport()
{
//$import_notice will show the import detail result
global $import_notice;
global $import_notice;
//Mock DBI
$dbi = $this->getMockBuilder('PMA_DatabaseInterface')
->disableOriginalConstructor()
->getMock();
$GLOBALS['dbi'] = $dbi;
//Test function called
$this->object->doImport();
// If import successfully, PMA will show all databases and
// If import successfully, PMA will show all databases and
// tables imported as following HTML Page
/*
The following structures have either been created or altered. Here you
The following structures have either been created or altered. Here you
can:
View a structure's contents by clicking on its name
Change any of its settings by clicking the corresponding "Options" link
@ -144,25 +144,25 @@ class ImportMediawiki_Test extends PHPUnit_Framework_TestCase
mediawiki_DB (Options)
pma_bookmarktest (Structure) (Options)
*/
*/
//asset that all databases and tables are imported
$this->assertContains(
'The following structures have either been created or altered.',
$import_notice
);
);
$this->assertContains(
'Go to database: `mediawiki_DB`',
$import_notice
);
);
$this->assertContains(
'Edit settings for `mediawiki_DB`',
$import_notice
);
);
$this->assertContains(
'Go to table: `pma_bookmarktest`',
$import_notice
);
);
$this->assertContains(
'Edit settings for `pma_bookmarktest`',
$import_notice
@ -170,7 +170,7 @@ class ImportMediawiki_Test extends PHPUnit_Framework_TestCase
$this->assertEquals(
true,
$GLOBALS['finished']
);
);
}
}

View File

@ -4,7 +4,7 @@
*
* @package PhpMyAdmin-test
*/
/*
* we must set $GLOBALS['server'] here
* since 'check_user_privileges.lib.php' will use it globally
@ -45,20 +45,20 @@ class ImportSql_Test extends PHPUnit_Framework_TestCase
* @return void
*/
protected function setUp()
{
$this->object = new ImportSql();
{
$this->object = new ImportSql();
//setting
//setting
$GLOBALS['finished'] = false;
$GLOBALS['read_limit'] = 100000000;
$GLOBALS['offset'] = 0;
$GLOBALS['cfg']['Server']['DisableIS'] = false;
$GLOBALS['cfg']['ServerDefault'] = 0;
$GLOBALS['cfg']['AllowUserDropDatabase'] = false;
$GLOBALS['import_file'] = 'test/test_data/pma_bookmark.sql';
$GLOBALS['import_text'] = 'ImportSql_Test';
$GLOBALS['compression'] = 'none';
$GLOBALS['compression'] = 'none';
$GLOBALS['read_multiply'] = 10;
$GLOBALS['import_type'] = 'Xml';
$GLOBALS['import_handle'] = @fopen($GLOBALS['import_file'], 'r');
@ -75,7 +75,7 @@ class ImportSql_Test extends PHPUnit_Framework_TestCase
{
unset($this->object);
}
/**
* Test for doImport
*
@ -88,36 +88,36 @@ class ImportSql_Test extends PHPUnit_Framework_TestCase
//$sql_query_disabled will show the import SQL detail
global $sql_query, $sql_query_disabled;
$sql_query_disabled = false;
//Mock DBI
$dbi = $this->getMockBuilder('PMA_DatabaseInterface')
->disableOriginalConstructor()
->getMock();
$GLOBALS['dbi'] = $dbi;
//Test function called
$this->object->doImport();
//asset that all sql are executed
$this->assertContains(
'SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";',
$sql_query
);
);
$this->assertContains(
'CREATE TABLE IF NOT EXISTS `pma_bookmark`',
$sql_query
);
);
$this->assertContains(
'INSERT INTO `pma_bookmark` (`id`, `dbase`, `user`, `label`, `query`) '
. 'VALUES',
$sql_query
);
);
$this->assertEquals(
true,
$GLOBALS['finished']
);
);
}
}

View File

@ -4,7 +4,7 @@
*
* @package PhpMyAdmin-test
*/
/*
* we must set $GLOBALS['server'] here
* since 'check_user_privileges.lib.php' will use it globally
@ -44,21 +44,21 @@ class ImportXml_Test extends PHPUnit_Framework_TestCase
* @return void
*/
protected function setUp()
{
$this->object = new ImportXml();
{
$this->object = new ImportXml();
//setting
//setting
$GLOBALS['finished'] = false;
$GLOBALS['read_limit'] = 100000000;
$GLOBALS['offset'] = 0;
$GLOBALS['cfg']['Server']['DisableIS'] = false;
$GLOBALS['cfg']['ServerDefault'] = 0;
$GLOBALS['cfg']['AllowUserDropDatabase'] = false;
$GLOBALS['import_file'] = 'test/test_data/phpmyadmin_importXML_'
. 'For_Testing.xml';
$GLOBALS['import_text'] = 'ImportXml_Test';
$GLOBALS['compression'] = 'none';
$GLOBALS['compression'] = 'none';
$GLOBALS['read_multiply'] = 10;
$GLOBALS['import_type'] = 'Xml';
$GLOBALS['import_handle'] = @fopen($GLOBALS['import_file'], 'r');
@ -75,7 +75,7 @@ class ImportXml_Test extends PHPUnit_Framework_TestCase
{
unset($this->object);
}
/**
* Test for getProperties
*
@ -89,26 +89,26 @@ class ImportXml_Test extends PHPUnit_Framework_TestCase
$this->assertEquals(
__('XML'),
$properties->getText()
);
);
$this->assertEquals(
'xml',
$properties->getExtension()
);
);
$this->assertEquals(
'text/xml',
$properties->getMimeType()
);
);
$this->assertEquals(
array(),
$properties->getOptions()
);
);
$this->assertEquals(
__('Options'),
$properties->getOptionsText()
);
);
}
/**
* Test for doImport
*
@ -119,18 +119,18 @@ class ImportXml_Test extends PHPUnit_Framework_TestCase
public function testDoImport()
{
//$import_notice will show the import detail result
global $import_notice;
global $import_notice;
//Mock DBI
$dbi = $this->getMockBuilder('PMA_DatabaseInterface')
->disableOriginalConstructor()
->getMock();
$GLOBALS['dbi'] = $dbi;
//Test function called
$this->object->doImport();
// If import successfully, PMA will show all databases and tables
// If import successfully, PMA will show all databases and tables
// imported as following HTML Page
/*
The following structures have either been created or altered. Here you
@ -141,25 +141,25 @@ class ImportXml_Test extends PHPUnit_Framework_TestCase
phpmyadmintest (Options)
pma_bookmarktest (Structure) (Options)
*/
*/
//asset that all databases and tables are imported
$this->assertContains(
'The following structures have either been created or altered.',
$import_notice
);
);
$this->assertContains(
'Go to database: `phpmyadmintest`',
$import_notice
);
);
$this->assertContains(
'Edit settings for `phpmyadmintest`',
$import_notice
);
);
$this->assertContains(
'Go to table: `pma_bookmarktest`',
$import_notice
);
);
$this->assertContains(
'Edit settings for `pma_bookmarktest`',
$import_notice
@ -167,8 +167,8 @@ class ImportXml_Test extends PHPUnit_Framework_TestCase
$this->assertEquals(
true,
$GLOBALS['finished']
);
);
}
}

View File

@ -124,7 +124,7 @@ class Image_PNG_Inline_Test extends PHPUnit_Framework_TestCase
$buffer = "PMA_PNG_Inline";
$options = array("./image/", "200", "wrapper_link"=>"PMA_wrapper_link");
$result = '<a href="transformation_wrapper.phpPMA_wrapper_link"'
. ' target="_blank"><img src="transformation_wrapper.php'
. ' target="_blank"><img src="transformation_wrapper.php'
. 'PMA_wrapper_link&amp;'
. 'resize=jpeg&amp;newWidth=./image/&amp;newHeight=200" '
. 'alt="PMA_PNG_Inline" border="0" /></a>';

View File

@ -34,7 +34,7 @@ class Text_Plain_Append_Test extends PHPUnit_Framework_TestCase
*/
protected function setUp()
{
$this->object = new Text_Plain_Append(new PluginManager());
$this->object = new Text_Plain_Append(new PluginManager());
}
/**
@ -48,7 +48,7 @@ class Text_Plain_Append_Test extends PHPUnit_Framework_TestCase
{
unset($this->object);
}
/**
* Test for getInfo
*
@ -58,14 +58,14 @@ class Text_Plain_Append_Test extends PHPUnit_Framework_TestCase
*/
public function testGetInfo()
{
$info = 'Appends text to a string. The only option is '
$info = 'Appends text to a string. The only option is '
. 'the text to be appended'
. ' (enclosed in single quotes, default empty string).';
. ' (enclosed in single quotes, default empty string).';
$this->assertEquals(
$info,
Text_Plain_Append::getInfo()
);
);
}
/**
@ -76,11 +76,11 @@ class Text_Plain_Append_Test extends PHPUnit_Framework_TestCase
* @group medium
*/
public function testGetName()
{
{
$this->assertEquals(
"Append",
Text_Plain_Append::getName()
);
);
}
/**
@ -91,11 +91,11 @@ class Text_Plain_Append_Test extends PHPUnit_Framework_TestCase
* @group medium
*/
public function testGetMIMEType()
{
{
$this->assertEquals(
"Text",
Text_Plain_Append::getMIMEType()
);
);
}
/**
@ -106,11 +106,11 @@ class Text_Plain_Append_Test extends PHPUnit_Framework_TestCase
* @group medium
*/
public function testGetMIMESubtype()
{
{
$this->assertEquals(
"Plain",
Text_Plain_Append::getMIMESubtype()
);
);
}
/**
@ -127,19 +127,19 @@ class Text_Plain_Append_Test extends PHPUnit_Framework_TestCase
$this->assertEquals(
"PMA_BUFFERoption1",
$this->object->applyTransformation($buffer, $options)
);
);
//no options
$result = "PMA_BUFFER";
$this->assertEquals(
$result,
$this->object->applyTransformation($buffer)
);
//html string
//html string
$result = "PMA_BUFFER&lt;a&gt;abc&lt;/a&gt;";
$options = array("<a>abc</a>");
$this->assertEquals(
$result,
$this->object->applyTransformation($buffer, $options)
);
);
}
}

View File

@ -165,7 +165,7 @@ class Text_Plain_Dateformat_Test extends PHPUnit_Framework_TestCase
//string
$timestamp = "20100201";
$result = '<dfn onclick="alert(\'20100201\');" title="20100201">'
$result = '<dfn onclick="alert(\'20100201\');" title="20100201">'
. 'Feb 01, 2010 at 12:00 AM</dfn>';
$this->assertEquals(
$result,

View File

@ -156,8 +156,8 @@ class Text_Plain_External_Test extends PHPUnit_Framework_TestCase
$this->object->applyTransformationNoWrap($options)
);
$options = array(
"/dev/null -i -wrap -q",
"/dev/null -i -wrap -q",
"/dev/null -i -wrap -q",
"/dev/null -i -wrap -q",
"/dev/null -i -wrap -q", 1
);
$this->assertEquals(
@ -165,8 +165,8 @@ class Text_Plain_External_Test extends PHPUnit_Framework_TestCase
$this->object->applyTransformationNoWrap($options)
);
$options = array(
"/dev/null -i -wrap -q",
"/dev/null -i -wrap -q",
"/dev/null -i -wrap -q",
"/dev/null -i -wrap -q",
"/dev/null -i -wrap -q", "1"
);
$this->assertEquals(
@ -174,9 +174,9 @@ class Text_Plain_External_Test extends PHPUnit_Framework_TestCase
$this->object->applyTransformationNoWrap($options)
);
$options = array(
"/dev/null -i -wrap -q",
"/dev/null -i -wrap -q",
"/dev/null -i -wrap -q",
"/dev/null -i -wrap -q",
"/dev/null -i -wrap -q",
"/dev/null -i -wrap -q",
2
);
$this->assertEquals(

View File

@ -60,7 +60,7 @@ class Text_Plain_Imagelink_Test extends PHPUnit_Framework_TestCase
{
$info = 'Displays an image and a link; '
. 'the column contains the filename. The first option'
. ' is a URL prefix like "http://www.example.com/". '
. ' is a URL prefix like "http://www.example.com/". '
. 'The second and third options'
. ' are the width and the height in pixels.';
$this->assertEquals(

View File

@ -35,7 +35,7 @@ class Text_Plain_Longtoipv4_Test extends PHPUnit_Framework_TestCase
*/
protected function setUp()
{
$this->object = new Text_Plain_Longtoipv4(new PluginManager());
$this->object = new Text_Plain_Longtoipv4(new PluginManager());
}
/**
@ -49,7 +49,7 @@ class Text_Plain_Longtoipv4_Test extends PHPUnit_Framework_TestCase
{
unset($this->object);
}
/**
* Test for getInfo
*
@ -60,12 +60,12 @@ class Text_Plain_Longtoipv4_Test extends PHPUnit_Framework_TestCase
public function testGetInfo()
{
$info = 'Converts an (IPv4) Internet network address into a string in'
. ' Internet standard dotted format.';
. ' Internet standard dotted format.';
$this->assertEquals(
$info,
Text_Plain_Longtoipv4::getInfo()
);
);
}
/**
@ -76,11 +76,11 @@ class Text_Plain_Longtoipv4_Test extends PHPUnit_Framework_TestCase
* @group medium
*/
public function testGetName()
{
{
$this->assertEquals(
"Long To IPv4",
Text_Plain_Longtoipv4::getName()
);
);
}
/**
@ -91,11 +91,11 @@ class Text_Plain_Longtoipv4_Test extends PHPUnit_Framework_TestCase
* @group medium
*/
public function testGetMIMEType()
{
{
$this->assertEquals(
"Text",
Text_Plain_Longtoipv4::getMIMEType()
);
);
}
/**
@ -106,11 +106,11 @@ class Text_Plain_Longtoipv4_Test extends PHPUnit_Framework_TestCase
* @group medium
*/
public function testGetMIMESubtype()
{
{
$this->assertEquals(
"Plain",
Text_Plain_Longtoipv4::getMIMESubtype()
);
);
}
/**
@ -127,14 +127,14 @@ class Text_Plain_Longtoipv4_Test extends PHPUnit_Framework_TestCase
$this->assertEquals(
"2.143.92.40",
$this->object->applyTransformation($buffer, $options)
);
//too big
);
//too big
$buffer = 4294967295;
$options = array("option1", "option2");
$this->assertEquals(
"255.255.255.255",
$this->object->applyTransformation($buffer, $options)
);
);
}
}

View File

@ -35,7 +35,7 @@ class Text_Plain_Substring_Test extends PHPUnit_Framework_TestCase
*/
protected function setUp()
{
$this->object = new Text_Plain_Substring(new PluginManager());
$this->object = new Text_Plain_Substring(new PluginManager());
}
/**
@ -63,11 +63,11 @@ class Text_Plain_Substring_Test extends PHPUnit_Framework_TestCase
. ' characters to skip from the beginning of the string (Default 0).'
. ' The second option is the number of characters to return (Default:'
. ' until end of string). The third option is the string to append';
$this->assertContains(
$info,
Text_Plain_Substring::getInfo()
);
);
}
/**
@ -78,11 +78,11 @@ class Text_Plain_Substring_Test extends PHPUnit_Framework_TestCase
* @group medium
*/
public function testGetName()
{
{
$this->assertEquals(
"Substring",
Text_Plain_Substring::getName()
);
);
}
/**
@ -93,11 +93,11 @@ class Text_Plain_Substring_Test extends PHPUnit_Framework_TestCase
* @group medium
*/
public function testGetMIMEType()
{
{
$this->assertEquals(
"Text",
Text_Plain_Substring::getMIMEType()
);
);
}
/**
@ -108,11 +108,11 @@ class Text_Plain_Substring_Test extends PHPUnit_Framework_TestCase
* @group medium
*/
public function testGetMIMESubtype()
{
{
$this->assertEquals(
"Plain",
Text_Plain_Substring::getMIMESubtype()
);
);
}
/**
@ -129,6 +129,6 @@ class Text_Plain_Substring_Test extends PHPUnit_Framework_TestCase
$this->assertEquals(
"suffixMA_suffix",
$this->object->applyTransformation($buffer, $options)
);
);
}
}

View File

@ -10,7 +10,7 @@ require_once 'libraries/properties/PropertyItem.class.php';
/**
* Tests for PropertyItem class
*
*
* @package PhpMyAdmin-test
*/
class PMA_PropertyItem_Test extends PHPUnit_Framework_TestCase
@ -29,7 +29,7 @@ class PMA_PropertyItem_Test extends PHPUnit_Framework_TestCase
/**
* tearDown for test cases
*
*
* @return void
*/
public function tearDown()
@ -39,7 +39,7 @@ class PMA_PropertyItem_Test extends PHPUnit_Framework_TestCase
/**
* Test for PropertyItem::getGroup
*
*
* @return void
*/
public function testGetGroup()

View File

@ -10,7 +10,7 @@ require_once 'libraries/properties/options/OptionsPropertyGroup.class.php';
/**
* Tests for OptionsPropertyGroup class
*
*
* @package PhpMyAdmin-test
*/
class PMA_OptionsPropertyGroup_Test extends PHPUnit_Framework_TestCase
@ -29,7 +29,7 @@ class PMA_OptionsPropertyGroup_Test extends PHPUnit_Framework_TestCase
/**
* tearDown for test cases
*
*
* @return void
*/
public function tearDown()
@ -39,7 +39,7 @@ class PMA_OptionsPropertyGroup_Test extends PHPUnit_Framework_TestCase
/**
* Test for OptionsPropertyGroup::addProperty
*
*
* @return void
*/
public function testAddProperty()
@ -63,7 +63,7 @@ class PMA_OptionsPropertyGroup_Test extends PHPUnit_Framework_TestCase
/**
* Test for OptionsPropertyGroup::removeProperty
*
*
* @return void
*/
public function testRemoveProperty()
@ -95,7 +95,7 @@ class PMA_OptionsPropertyGroup_Test extends PHPUnit_Framework_TestCase
/**
* Test for OptionsPropertyGroup::getGroup
*
*
* @return void
*/
public function testGetGroup()
@ -108,7 +108,7 @@ class PMA_OptionsPropertyGroup_Test extends PHPUnit_Framework_TestCase
/**
* Test for OptionsPropertyGroup::getProperties
*
*
* @return void
*/
public function testGetProperties()
@ -125,7 +125,7 @@ class PMA_OptionsPropertyGroup_Test extends PHPUnit_Framework_TestCase
/**
* Test for OptionsPropertyGroup::getProperties
*
*
* @return void
*/
public function testGetNrOfProperties()

View File

@ -10,7 +10,7 @@ require_once 'libraries/properties/options/OptionsPropertyItem.class.php';
/**
* Tests for OptionsPropertyItem class
*
*
* @package PhpMyAdmin-test
*/
class PMA_OptionsPropertyItem_Test extends PHPUnit_Framework_TestCase
@ -29,7 +29,7 @@ class PMA_OptionsPropertyItem_Test extends PHPUnit_Framework_TestCase
/**
* tearDown for test cases
*
*
* @return void
*/
public function tearDown()
@ -41,7 +41,7 @@ class PMA_OptionsPropertyItem_Test extends PHPUnit_Framework_TestCase
* Test for
* - OptionsPropertyItem::getName
* - OptionsPropertyItem::setName
*
*
* @return void
*/
public function testGetSetName()
@ -58,7 +58,7 @@ class PMA_OptionsPropertyItem_Test extends PHPUnit_Framework_TestCase
* Test for
* - OptionsPropertyItem::getText
* - OptionsPropertyItem::setText
*
*
* @return void
*/
public function testGetSetText()
@ -75,7 +75,7 @@ class PMA_OptionsPropertyItem_Test extends PHPUnit_Framework_TestCase
* Test for
* - OptionsPropertyItem::getForce
* - OptionsPropertyItem::setForce
*
*
* @return void
*/
public function testGetSetForce()
@ -90,7 +90,7 @@ class PMA_OptionsPropertyItem_Test extends PHPUnit_Framework_TestCase
/**
* Test for OptionsPropertyItem::getPropertyType
*
*
* @return void
*/
public function testGetPropertyType()

View File

@ -10,7 +10,7 @@ require_once 'libraries/properties/options/OptionsPropertyOneItem.class.php';
/**
* Tests for OptionsPropertyOneItem class
*
*
* @package PhpMyAdmin-test
*/
class PMA_OptionsPropertyOneItem_Test extends PHPUnit_Framework_TestCase
@ -29,7 +29,7 @@ class PMA_OptionsPropertyOneItem_Test extends PHPUnit_Framework_TestCase
/**
* tearDown for test cases
*
*
* @return void
*/
public function tearDown()
@ -41,7 +41,7 @@ class PMA_OptionsPropertyOneItem_Test extends PHPUnit_Framework_TestCase
* Test for
* - OptionsPropertyOneItem::getValues
* - OptionsPropertyOneItem::setValues
*
*
* @return void
*/
public function testGetSetValues()
@ -58,7 +58,7 @@ class PMA_OptionsPropertyOneItem_Test extends PHPUnit_Framework_TestCase
* Test for
* - OptionsPropertyOneItem::getLen
* - OptionsPropertyOneItem::setLen
*
*
* @return void
*/
public function testGetSetLen()
@ -75,7 +75,7 @@ class PMA_OptionsPropertyOneItem_Test extends PHPUnit_Framework_TestCase
* Test for
* - OptionsPropertyOneItem::getForce
* - OptionsPropertyOneItem::setForce
*
*
* @return void
*/
public function testGetSetForce()
@ -92,7 +92,7 @@ class PMA_OptionsPropertyOneItem_Test extends PHPUnit_Framework_TestCase
* Test for
* - OptionsPropertyOneItem::getDoc
* - OptionsPropertyOneItem::setDoc
*
*
* @return void
*/
public function testGetSetDoc()
@ -109,7 +109,7 @@ class PMA_OptionsPropertyOneItem_Test extends PHPUnit_Framework_TestCase
* Test for
* - OptionsPropertyOneItem::getSize
* - OptionsPropertyOneItem::setSize
*
*
* @return void
*/
public function testGetSetSize()

View File

@ -28,17 +28,17 @@ class PMA_OptionsPropertyMainGroup_Test extends PHPUnit_Framework_TestCase
/**
* tearDown for test cases
*
*
* @return void
*/
protected function tearDown()
{
unset($this->object);
}
/**
* Test for OptionsPropertyMainGroup::getItemType
*
*
* @return void
*/
public function testGetItemType()

View File

@ -28,17 +28,17 @@ class PMA_OptionsPropertyRootGroup_Test extends PHPUnit_Framework_TestCase
/**
* tearDown for test cases
*
*
* @return void
*/
protected function tearDown()
{
unset($this->object);
}
/**
* Test for OptionsPropertyRootGroup::getItemType
*
*
* @return void
*/
public function testGetItemType()

View File

@ -28,17 +28,17 @@ class PMA_OptionsPropertySubgroup_Test extends PHPUnit_Framework_TestCase
/**
* tearDown for test cases
*
*
* @return void
*/
protected function tearDown()
{
unset($this->object);
}
/**
* Test for OptionsPropertySubgroup::getItemType
*
*
* @return void
*/
public function testGetItemType()
@ -52,8 +52,8 @@ class PMA_OptionsPropertySubgroup_Test extends PHPUnit_Framework_TestCase
/**
* Test for
* - OptionsPropertySubgroup::getSubgroupHeader
* - OptionsPropertySubgroup::setSubgroupHeader
*
* - OptionsPropertySubgroup::setSubgroupHeader
*
* @return void
*/
public function testGetSetSubgroupHeader()

View File

@ -22,7 +22,7 @@ class PMA_PropertyItems_Test extends PHPUnit_Framework_TestCase
{
/**
* Test for BoolPropertyItem::getItemType
*
*
* @return void
*/
public function testBoolGetItemType()
@ -37,7 +37,7 @@ class PMA_PropertyItems_Test extends PHPUnit_Framework_TestCase
/**
* Test for DocPropertyItem::getItemType
*
*
* @return void
*/
public function testGetItemTypeDoc()
@ -52,7 +52,7 @@ class PMA_PropertyItems_Test extends PHPUnit_Framework_TestCase
/**
* Test for HiddenPropertyItem::getItemType
*
*
* @return void
*/
public function testGetItemTypeHidden()
@ -67,7 +67,7 @@ class PMA_PropertyItems_Test extends PHPUnit_Framework_TestCase
/**
* Test for MessageOnlyPropertyItem::getItemType
*
*
* @return void
*/
public function testGetItemTypeMessageOnly()
@ -82,7 +82,7 @@ class PMA_PropertyItems_Test extends PHPUnit_Framework_TestCase
/**
* Test for RadioPropertyItem::getItemType
*
*
* @return void
*/
public function testGetItemTypeRadio()
@ -97,7 +97,7 @@ class PMA_PropertyItems_Test extends PHPUnit_Framework_TestCase
/**
* Test for SelectPropertyItem::getItemType
*
*
* @return void
*/
public function testGetItemTypeSelect()
@ -112,7 +112,7 @@ class PMA_PropertyItems_Test extends PHPUnit_Framework_TestCase
/**
* Test for TextPropertyItem::getItemType
*
*
* @return void
*/
public function testGetItemTypeText()

View File

@ -11,9 +11,9 @@ require_once 'libraries/properties/options/groups/OptionsPropertyRootGroup.class
require_once 'test/classes/properties/plugins/PMA_ImportPluginProperties_test.php';
/**
* Tests for ExportPluginProperties class. Extends PMA_ImportPluginProperties_Tests
* Tests for ExportPluginProperties class. Extends PMA_ImportPluginProperties_Tests
* and adds tests for methods that are not common to both
*
*
* @package PhpMyAdmin-test
*/
class PMA_ExportPluginProperties_Test extends PMA_ImportPluginProperties_Test
@ -32,7 +32,7 @@ class PMA_ExportPluginProperties_Test extends PMA_ImportPluginProperties_Test
/**
* tearDown for test cases
*
*
* @return void
*/
public function tearDown()
@ -42,7 +42,7 @@ class PMA_ExportPluginProperties_Test extends PMA_ImportPluginProperties_Test
/**
* Test for ExportPluginProperties::getItemType
*
*
* @return void
*/
public function testGetItemType()
@ -57,7 +57,7 @@ class PMA_ExportPluginProperties_Test extends PMA_ImportPluginProperties_Test
* Test for
* - ExportPluginProperties::getForceFile
* - ExportPluginProperties::setForceFile
*
*
* @return void
*/
public function testSetGetForceFile()

View File

@ -29,17 +29,17 @@ class PMA_ImportPluginProperties_Test extends PHPUnit_Framework_TestCase
/**
* tearDown for test cases
*
*
* @return void
*/
protected function tearDown()
{
unset($this->object);
}
/**
* Test for ImportPluginProperties::getItemType
*
*
* @return void
*/
public function testGetItemType()
@ -51,10 +51,10 @@ class PMA_ImportPluginProperties_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for
* Test for
* - ImportPluginProperties::getOptionsText
* - ImportPluginProperties::setOptionsText
*
*
* @return void
*/
public function testSetGetOptionsText()
@ -68,10 +68,10 @@ class PMA_ImportPluginProperties_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for
* Test for
* - ImportPluginProperties::setMimeType
* - ImportPluginProperties::getMimeType
*
*
* @return void
*/
public function testSetGetMimeType()

View File

@ -10,7 +10,7 @@ require_once 'libraries/properties/plugins/PluginPropertyItem.class.php';
/**
* Tests for PluginPropertyItem class
*
*
* @package PhpMyAdmin-test
*/
class PMA_PluginPropertyItem_Test extends PHPUnit_Framework_TestCase
@ -29,7 +29,7 @@ class PMA_PluginPropertyItem_Test extends PHPUnit_Framework_TestCase
/**
* tearDown for test cases
*
*
* @return void
*/
public function tearDown()
@ -39,7 +39,7 @@ class PMA_PluginPropertyItem_Test extends PHPUnit_Framework_TestCase
/**
* Test for PluginPropertyItem::getPropertyType
*
*
* @return void
*/
public function testGetPropertyType()

View File

@ -46,13 +46,13 @@ class PMA_Dia_Relation_Schema_Test extends PHPUnit_Framework_TestCase
$_POST['orientation'] = 'orientation';
$_POST['paper'] = 'paper';
$_POST['export_type'] = 'PMA_ExportType';
$GLOBALS['server'] = 1;
$GLOBALS['controllink'] = null;
$GLOBALS['db'] = 'information_schema';
$GLOBALS['cfg']['ServerDefault'] = 1;
$GLOBALS['cfg']['Server']['table_coords'] = "table_name";
//_SESSION
$_SESSION['relation'][$GLOBALS['server']] = array(
'table_coords' => "table_name",
@ -62,28 +62,28 @@ class PMA_Dia_Relation_Schema_Test extends PHPUnit_Framework_TestCase
'relwork' => 'relwork',
'relation' => 'relation'
);
$dbi = $this->getMockBuilder('PMA_DatabaseInterface')
->disableOriginalConstructor()
->getMock();
$dbi->expects($this->any())
->method('numRows')
->will($this->returnValue(1));
$dbi->expects($this->any())
->method('query')
->will($this->returnValue("executed_1"));
$dbi->expects($this->any())
->method('tryQuery')
->will($this->returnValue("executed_1"));
$fetchArrayReturn = array(
//table name in information_schema_relations
'table_name' => 'CHARACTER_SETS'
);
$fetchArrayReturn2 = array(
//table name in information_schema_relations
'table_name' => 'COLLATIONS'
@ -98,7 +98,7 @@ class PMA_Dia_Relation_Schema_Test extends PHPUnit_Framework_TestCase
$dbi->expects($this->at(4))
->method('fetchAssoc')
->will($this->returnValue(false));
$getIndexesResult = array(
array(
'Table' => 'pma_tbl',
@ -110,7 +110,7 @@ class PMA_Dia_Relation_Schema_Test extends PHPUnit_Framework_TestCase
);
$dbi->expects($this->any())->method('getTableIndexes')
->will($this->returnValue($getIndexesResult));
$fetchValue = "CREATE TABLE `pma_bookmark` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`dbase` varchar(255) COLLATE utf8_bin NOT NULL DEFAULT '',
@ -118,15 +118,15 @@ class PMA_Dia_Relation_Schema_Test extends PHPUnit_Framework_TestCase
`label` varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT '',
`query` text COLLATE utf8_bin NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 "
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 "
. "COLLATE=utf8_bin COMMENT='Bookmarks'";
$dbi->expects($this->any())
->method('fetchValue')
->will($this->returnValue($fetchValue));
->will($this->returnValue($fetchValue));
$GLOBALS['dbi'] = $dbi;
$this->object = new PMA_Dia_Relation_Schema();
}
@ -154,27 +154,27 @@ class PMA_Dia_Relation_Schema_Test extends PHPUnit_Framework_TestCase
$this->assertEquals(
33,
$this->object->pageNumber
);
);
$this->assertEquals(
1,
$this->object->showGrid
);
);
$this->assertEquals(
1,
$this->object->showColor
);
);
$this->assertEquals(
1,
$this->object->showKeys
);
);
$this->assertEquals(
'P',
$this->object->orientation
);
);
$this->assertEquals(
'paper',
$this->object->paper
);
);
$this->assertEquals(
'PMA_ExportType',
$this->object->exportType

View File

@ -52,7 +52,7 @@ class PMA_Eps_Relation_Schema_Test extends PHPUnit_Framework_TestCase
$GLOBALS['db'] = 'information_schema';
$GLOBALS['cfg']['ServerDefault'] = 1;
$GLOBALS['cfg']['Server']['table_coords'] = "table_name";
//_SESSION
$_SESSION['relation'][$GLOBALS['server']] = array(
'table_coords' => "table_name",
@ -62,28 +62,28 @@ class PMA_Eps_Relation_Schema_Test extends PHPUnit_Framework_TestCase
'relwork' => 'relwork',
'relation' => 'relation'
);
$dbi = $this->getMockBuilder('PMA_DatabaseInterface')
->disableOriginalConstructor()
->getMock();
$dbi->expects($this->any())
->method('numRows')
->will($this->returnValue(1));
$dbi->expects($this->any())
->method('query')
->will($this->returnValue("executed_1"));
$dbi->expects($this->any())
->method('tryQuery')
->will($this->returnValue("executed_1"));
$fetchArrayReturn = array(
//table name in information_schema_relations
'table_name' => 'CHARACTER_SETS'
);
$fetchArrayReturn2 = array(
//table name in information_schema_relations
'table_name' => 'COLLATIONS'
@ -98,7 +98,7 @@ class PMA_Eps_Relation_Schema_Test extends PHPUnit_Framework_TestCase
$dbi->expects($this->at(4))
->method('fetchAssoc')
->will($this->returnValue(false));
$getIndexesResult = array(
array(
'Table' => 'pma_tbl',
@ -110,7 +110,7 @@ class PMA_Eps_Relation_Schema_Test extends PHPUnit_Framework_TestCase
);
$dbi->expects($this->any())->method('getTableIndexes')
->will($this->returnValue($getIndexesResult));
$fetchValue = "CREATE TABLE `pma_bookmark` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`dbase` varchar(255) COLLATE utf8_bin NOT NULL DEFAULT '',
@ -118,16 +118,16 @@ class PMA_Eps_Relation_Schema_Test extends PHPUnit_Framework_TestCase
`label` varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT '',
`query` text COLLATE utf8_bin NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 "
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 "
. "COLLATE=utf8_bin COMMENT='Bookmarks'";
$dbi->expects($this->any())
->method('fetchValue')
->will($this->returnValue($fetchValue));
->will($this->returnValue($fetchValue));
$GLOBALS['dbi'] = $dbi;
$this->object = new PMA_Eps_Relation_Schema();
$this->object = new PMA_Eps_Relation_Schema();
}
/**
@ -150,23 +150,23 @@ class PMA_Eps_Relation_Schema_Test extends PHPUnit_Framework_TestCase
* @group medium
*/
public function testConstructor()
{
{
$this->assertEquals(
33,
$this->object->pageNumber
);
);
$this->assertEquals(
1,
$this->object->showColor
);
);
$this->assertEquals(
1,
$this->object->showKeys
);
);
$this->assertEquals(
1,
$this->object->tableDimension
);
);
$this->assertEquals(
1,
$this->object->sameWide
@ -174,7 +174,7 @@ class PMA_Eps_Relation_Schema_Test extends PHPUnit_Framework_TestCase
$this->assertEquals(
'L',
$this->object->orientation
);
);
$this->assertEquals(
'PMA_ExportType',
$this->object->exportType
@ -190,7 +190,7 @@ class PMA_Eps_Relation_Schema_Test extends PHPUnit_Framework_TestCase
*/
public function testSetPageNumbere()
{
$this->object->setPageNumber(33);
$this->object->setPageNumber(33);
$this->assertEquals(
33,
$this->object->pageNumber

View File

@ -50,7 +50,7 @@ class PMA_Pdf_Relation_Schema_Test extends PHPUnit_Framework_TestCase
$_POST['paper'] = 'paper';
$_POST['export_type'] = 'PMA_ExportType';
$_POST['with_doc'] = 'on';
$GLOBALS['server'] = 1;
$GLOBALS['controllink'] = null;
$GLOBALS['db'] = 'information_schema';
@ -62,7 +62,7 @@ class PMA_Pdf_Relation_Schema_Test extends PHPUnit_Framework_TestCase
$GLOBALS['cfg']['Server']['bookmarktable'] = "bookmarktable";
$GLOBALS['cfg']['Server']['relation'] = "relation";
$GLOBALS['cfg']['Server']['table_info'] = "table_info";
//_SESSION
$_SESSION['relation'][$GLOBALS['server']] = array(
'table_coords' => "table_name",
@ -75,28 +75,28 @@ class PMA_Pdf_Relation_Schema_Test extends PHPUnit_Framework_TestCase
'commwork' => 'commwork',
'column_info' => 'column_info'
);
$dbi = $this->getMockBuilder('PMA_DatabaseInterface')
->disableOriginalConstructor()
->getMock();
$dbi->expects($this->any())
->method('numRows')
->will($this->returnValue(1));
$dbi->expects($this->any())
->method('query')
->will($this->returnValue("executed_1"));
$dbi->expects($this->any())
->method('tryQuery')
->will($this->returnValue("executed_1"));
$fetchArrayReturn = array(
//table name in information_schema_relations
'table_name' => 'CHARACTER_SETS'
);
$fetchArrayReturn2 = array(
//table name in information_schema_relations
'table_name' => 'COLLATIONS'
@ -111,7 +111,7 @@ class PMA_Pdf_Relation_Schema_Test extends PHPUnit_Framework_TestCase
$dbi->expects($this->at(4))
->method('fetchAssoc')
->will($this->returnValue(false));
$fetchRowReturn = array(
'table_name'
);
@ -122,7 +122,7 @@ class PMA_Pdf_Relation_Schema_Test extends PHPUnit_Framework_TestCase
->method('fetchRow')
->will($this->returnValue($fetchRowReturn));
}
$dbi->expects($this->at(10))
->method('fetchRow')
->will($this->returnValue($fetchRowReturn));
@ -137,10 +137,10 @@ class PMA_Pdf_Relation_Schema_Test extends PHPUnit_Framework_TestCase
);
$dbi->expects($this->any())->method('getColumns')
->will($this->returnValue($fields_info));
$dbi->expects($this->any())->method('selectDb')
->will($this->returnValue(true));
$getIndexesResult = array(
array(
'Table' => 'pma_tbl',
@ -152,7 +152,7 @@ class PMA_Pdf_Relation_Schema_Test extends PHPUnit_Framework_TestCase
);
$dbi->expects($this->any())->method('getTableIndexes')
->will($this->returnValue($getIndexesResult));
$fetchValue = "CREATE TABLE `pma_bookmark` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`dbase` varchar(255) COLLATE utf8_bin NOT NULL DEFAULT '',
@ -160,25 +160,25 @@ class PMA_Pdf_Relation_Schema_Test extends PHPUnit_Framework_TestCase
`label` varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT '',
`query` text COLLATE utf8_bin NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 "
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 "
. "COLLATE=utf8_bin COMMENT='Bookmarks'";
$dbi->expects($this->any())
->method('fetchValue')
->will($this->returnValue($fetchValue));
->will($this->returnValue($fetchValue));
$fetchResult = array(
'column1' => array('mimetype' => 'value1', 'transformation'=> 'pdf'),
'column2' => array('mimetype' => 'value2', 'transformation'=> 'xml'),
);
$dbi->expects($this->any())->method('fetchResult')
->will($this->returnValue($fetchResult));
$GLOBALS['dbi'] = $dbi;
$this->object = new PMA_Pdf_Relation_Schema();
$this->object = new PMA_Pdf_Relation_Schema();
}
/**
@ -201,31 +201,31 @@ class PMA_Pdf_Relation_Schema_Test extends PHPUnit_Framework_TestCase
* @group medium
*/
public function testConstructor()
{
{
$this->assertEquals(
33,
$this->object->pageNumber
);
);
$this->assertEquals(
1,
$this->object->showGrid
);
);
$this->assertEquals(
1,
$this->object->showColor
);
);
$this->assertEquals(
1,
$this->object->showKeys
);
);
$this->assertEquals(
1,
$this->object->tableDimension
);
);
$this->assertEquals(
1,
$this->object->sameWide
);
);
$this->assertEquals(
1,
$this->object->withDoc
@ -233,14 +233,14 @@ class PMA_Pdf_Relation_Schema_Test extends PHPUnit_Framework_TestCase
$this->assertEquals(
'L',
$this->object->orientation
);
);
$this->assertEquals(
'PMA_ExportType',
$this->object->exportType
);
);
$this->assertEquals(
'paper',
$this->object->paper
);
);
}
}

View File

@ -53,7 +53,7 @@ class PMA_Svg_Relation_Schema_Test extends PHPUnit_Framework_TestCase
$GLOBALS['db'] = 'information_schema';
$GLOBALS['cfg']['ServerDefault'] = 1;
$GLOBALS['cfg']['Server']['table_coords'] = "table_name";
//_SESSION
$_SESSION['relation'][$GLOBALS['server']] = array(
'table_coords' => "table_name",
@ -63,28 +63,28 @@ class PMA_Svg_Relation_Schema_Test extends PHPUnit_Framework_TestCase
'relwork' => 'relwork',
'relation' => 'relation'
);
$dbi = $this->getMockBuilder('PMA_DatabaseInterface')
->disableOriginalConstructor()
->getMock();
$dbi->expects($this->any())
->method('numRows')
->will($this->returnValue(1));
$dbi->expects($this->any())
->method('query')
->will($this->returnValue("executed_1"));
$dbi->expects($this->any())
->method('tryQuery')
->will($this->returnValue("executed_1"));
$fetchArrayReturn = array(
//table name in information_schema_relations
'table_name' => 'CHARACTER_SETS'
);
$fetchArrayReturn2 = array(
//table name in information_schema_relations
'table_name' => 'COLLATIONS'
@ -99,7 +99,7 @@ class PMA_Svg_Relation_Schema_Test extends PHPUnit_Framework_TestCase
$dbi->expects($this->at(4))
->method('fetchAssoc')
->will($this->returnValue(false));
$getIndexesResult = array(
array(
'Table' => 'pma_tbl',
@ -111,7 +111,7 @@ class PMA_Svg_Relation_Schema_Test extends PHPUnit_Framework_TestCase
);
$dbi->expects($this->any())->method('getTableIndexes')
->will($this->returnValue($getIndexesResult));
$fetchValue = "CREATE TABLE `pma_bookmark` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`dbase` varchar(255) COLLATE utf8_bin NOT NULL DEFAULT '',
@ -119,16 +119,16 @@ class PMA_Svg_Relation_Schema_Test extends PHPUnit_Framework_TestCase
`label` varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT '',
`query` text COLLATE utf8_bin NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 "
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 "
. "COLLATE=utf8_bin COMMENT='Bookmarks'";
$dbi->expects($this->any())
->method('fetchValue')
->will($this->returnValue($fetchValue));
->will($this->returnValue($fetchValue));
$GLOBALS['dbi'] = $dbi;
$this->object = new PMA_Svg_Relation_Schema();
$this->object = new PMA_Svg_Relation_Schema();
}
/**
@ -151,23 +151,23 @@ class PMA_Svg_Relation_Schema_Test extends PHPUnit_Framework_TestCase
* @group medium
*/
public function testConstructor()
{
{
$this->assertEquals(
33,
$this->object->pageNumber
);
);
$this->assertEquals(
1,
$this->object->showColor
);
);
$this->assertEquals(
1,
$this->object->showKeys
);
);
$this->assertEquals(
1,
$this->object->tableDimension
);
);
$this->assertEquals(
1,
$this->object->sameWide
@ -175,6 +175,6 @@ class PMA_Svg_Relation_Schema_Test extends PHPUnit_Framework_TestCase
$this->assertEquals(
'PMA_ExportType',
$this->object->exportType
);
);
}
}

View File

@ -31,7 +31,7 @@ class PMA_Svg_Test extends PHPUnit_Framework_TestCase
*/
protected function setUp()
{
$this->object = new PMA_SVG();
$this->object = new PMA_SVG();
}
/**
@ -76,7 +76,7 @@ class PMA_Svg_Test extends PHPUnit_Framework_TestCase
12,
$this->object->getStringWidth("aa", "arial", "10")
);
// string "i"
$this->assertEquals(
3,

View File

@ -55,14 +55,14 @@ class PMA_User_Schema_Test extends PHPUnit_Framework_TestCase
$GLOBALS['cfgRelation']['table_coords'] = "table_name";
$GLOBALS['cfgRelation']['pdf_pages'] = "pdf_pages";
$GLOBALS['cfgRelation']['relation'] = "relation";
$dbi = $this->getMockBuilder('PMA_DatabaseInterface')
->disableOriginalConstructor()
->getMock();
$dbi->expects($this->any())
->method('insertId')
->will($this->returnValue(10));
->will($this->returnValue(10));
$databases = array();
$database_name = 'PMA';
@ -73,13 +73,13 @@ class PMA_User_Schema_Test extends PHPUnit_Framework_TestCase
$databases[$database_name]['SCHEMA_INDEX_LENGTH'] = 10;
$databases[$database_name]['SCHEMA_LENGTH'] = 10;
$databases[$database_name]['ENGINE'] = "InnerDB";
$dbi->expects($this->any())->method('getTablesFull')
->will($this->returnValue($databases));
->will($this->returnValue($databases));
$GLOBALS['dbi'] = $dbi;
$this->object = new PMA_User_Schema();
$this->object = new PMA_User_Schema();
}
/**
@ -106,48 +106,48 @@ class PMA_User_Schema_Test extends PHPUnit_Framework_TestCase
//action: selectpage
$_REQUEST['chpage'] = 10;
$_REQUEST['action_choose'] = '2';
$this->object->setAction("selectpage");
$this->object->processUserChoice();
$this->object->setAction("selectpage");
$this->object->processUserChoice();
$this->assertEquals(
"selectpage",
$this->object->action
);
);
$this->assertEquals(
10,
$this->object->chosenPage
);
$_REQUEST['action_choose'] = '1';
$this->object->processUserChoice();
$this->object->processUserChoice();
//deleteCoordinates successfully
$this->assertEquals(
0,
$this->object->chosenPage
);
//action: createpage
$_POST['newpage'] = "3";
$_POST['auto_layout_foreign'] = true;
$_POST['auto_layout_internal'] = true;
$_POST['delrow'] = array("row1", "row2");
$_POST['chpage'] = "chpage";
$this->object->setAction("delete_old_references");
$this->object->processUserChoice();
$this->object->setAction("createpage");
$this->object->processUserChoice();
$this->object->setAction("delete_old_references");
$this->object->processUserChoice();
$this->object->setAction("createpage");
$this->object->processUserChoice();
$this->assertEquals(
10,
$this->object->pageNumber
);
);
$this->assertEquals(
"1",
$this->object->autoLayoutForeign
);
);
$this->assertEquals(
"1",
$this->object->autoLayoutInternal
);
//action: edcoord
$_POST['chpage'] = "3";
$_POST['c_table_rows'] = 1;
@ -158,15 +158,15 @@ class PMA_User_Schema_Test extends PHPUnit_Framework_TestCase
'delete' => 'delete0',
'x' => 'x0',
);
$this->object->setAction("edcoord");
$this->object->processUserChoice();
$this->object->setAction("edcoord");
$this->object->processUserChoice();
$this->assertEquals(
'3',
$this->object->chosenPage
);
);
$this->assertEquals(
1,
$this->object->c_table_rows
);
);
}
}

View File

@ -201,9 +201,9 @@ class PMA_StorageEngine_pbxt_Test extends PHPUnit_Framework_TestCase
. '</p>' . "\n"
. '<h3>' . __('Related Links') . '</h3>' . "\n"
. '<ul>' . "\n"
. '<li><a href="' . PMA_linkURL('http://pbxt.blogspot.com/')
. '" target="_blank">'
. __('The PrimeBase XT Blog by Paul McCullagh')
. '<li><a href="' . PMA_linkURL('http://pbxt.blogspot.com/')
. '" target="_blank">'
. __('The PrimeBase XT Blog by Paul McCullagh')
. '</a></li>' . "\n" . '</ul>' . "\n"
);

View File

@ -91,7 +91,9 @@ class PMA_ConfigFile_Test extends PHPUnit_Framework_TestCase
);
// Validate default value used in tests
$default_value = $this->object->getDefault(self::SIMPLE_KEY_WITH_DEFAULT_VALUE);
$default_value = $this->object->getDefault(
self::SIMPLE_KEY_WITH_DEFAULT_VALUE
);
$this->assertNotNull($default_value);
}
@ -103,7 +105,9 @@ class PMA_ConfigFile_Test extends PHPUnit_Framework_TestCase
*/
public function testPersistentKeys()
{
$default_simple_value = $this->object->getDefault(self::SIMPLE_KEY_WITH_DEFAULT_VALUE);
$default_simple_value = $this->object->getDefault(
self::SIMPLE_KEY_WITH_DEFAULT_VALUE
);
$default_host = $this->object->getDefault('Servers/1/host');
$default_config = array(
self::SIMPLE_KEY_WITH_DEFAULT_VALUE => $default_simple_value,
@ -113,14 +117,16 @@ class PMA_ConfigFile_Test extends PHPUnit_Framework_TestCase
/**
* Case 1: set default value, key should not be persisted
*/
$this->object->set(self::SIMPLE_KEY_WITH_DEFAULT_VALUE, $default_simple_value);
$this->object->set(
self::SIMPLE_KEY_WITH_DEFAULT_VALUE, $default_simple_value
);
$this->object->set('Servers/1/host', $default_host);
$this->object->set('Servers/2/host', $default_host);
$this->assertEmpty($this->object->getConfig());
/**
* Case 2: persistent keys should be always present in flat array, even if not explicitly set
* (unless they are Server entries)
* Case 2: persistent keys should be always present in flat array,
* even if not explicitly set (unless they are Server entries)
*/
$this->object->setPersistKeys(array_keys($default_config));
$this->object->resetConfigData();
@ -131,7 +137,8 @@ class PMA_ConfigFile_Test extends PHPUnit_Framework_TestCase
);
/**
* Case 3: persistent keys should be always saved, even if set to default values
* Case 3: persistent keys should be always saved,
* even if set to default values
*/
$this->object->set('Servers/2/host', $default_host);
$this->assertEquals(
@ -182,9 +189,12 @@ class PMA_ConfigFile_Test extends PHPUnit_Framework_TestCase
*/
public function testConfigReadMapping()
{
$this->object->setCfgUpdateReadMapping(array(
$this->object->setCfgUpdateReadMapping(
array(
'Servers/value1' => 'Servers/1/value1',
'Servers/value2' => 'Servers/1/value2'));
'Servers/value2' => 'Servers/1/value2'
)
);
$this->object->set('Servers/1/passthrough1', 1);
$this->object->set('Servers/1/passthrough2', 2);
$this->object->updateWithGlobalConfig(array('Servers/value1' => 3));
@ -290,7 +300,9 @@ class PMA_ConfigFile_Test extends PHPUnit_Framework_TestCase
*/
public function testConfigFileSetInSetup()
{
$default_value = $this->object->getDefault(self::SIMPLE_KEY_WITH_DEFAULT_VALUE);
$default_value = $this->object->getDefault(
self::SIMPLE_KEY_WITH_DEFAULT_VALUE
);
// default values are not written
$this->object->set(self::SIMPLE_KEY_WITH_DEFAULT_VALUE, $default_value);
@ -305,17 +317,23 @@ class PMA_ConfigFile_Test extends PHPUnit_Framework_TestCase
*/
public function testConfigFileSetInUserPreferences()
{
$default_value = $this->object->getDefault(self::SIMPLE_KEY_WITH_DEFAULT_VALUE);
$default_value = $this->object->getDefault(
self::SIMPLE_KEY_WITH_DEFAULT_VALUE
);
// values are not written when they are the same as in config.inc.php
$this->object = new ConfigFile(array(self::SIMPLE_KEY_WITH_DEFAULT_VALUE => $default_value));
$this->object = new ConfigFile(
array(self::SIMPLE_KEY_WITH_DEFAULT_VALUE => $default_value)
);
$this->object->set(self::SIMPLE_KEY_WITH_DEFAULT_VALUE, $default_value);
$this->assertEmpty($this->object->getConfig());
// but if config.inc.php differs from config.default.php, allow to overwrite with
// value from config.default.php
// but if config.inc.php differs from config.default.php,
// allow to overwrite with value from config.default.php
$config_inc_php_value = $default_value . 'suffix';
$this->object = new ConfigFile(array(self::SIMPLE_KEY_WITH_DEFAULT_VALUE => $config_inc_php_value));
$this->object = new ConfigFile(
array(self::SIMPLE_KEY_WITH_DEFAULT_VALUE => $config_inc_php_value)
);
$this->object->set(self::SIMPLE_KEY_WITH_DEFAULT_VALUE, $default_value);
$this->assertEquals(
array(self::SIMPLE_KEY_WITH_DEFAULT_VALUE => $default_value),
@ -333,11 +351,17 @@ class PMA_ConfigFile_Test extends PHPUnit_Framework_TestCase
{
$flat_default_config = $this->object->getFlatDefaultConfig();
$default_value = $this->object->getDefault(self::SIMPLE_KEY_WITH_DEFAULT_VALUE);
$this->assertEquals($default_value, $flat_default_config[self::SIMPLE_KEY_WITH_DEFAULT_VALUE]);
$default_value = $this->object->getDefault(
self::SIMPLE_KEY_WITH_DEFAULT_VALUE
);
$this->assertEquals(
$default_value, $flat_default_config[self::SIMPLE_KEY_WITH_DEFAULT_VALUE]
);
$localhost_value = $this->object->getDefault('Servers/1/host');
$this->assertEquals($localhost_value, $flat_default_config['Servers/1/host']);
$this->assertEquals(
$localhost_value, $flat_default_config['Servers/1/host']
);
$cfg = array();
include './libraries/config.default.php';
@ -398,11 +422,13 @@ class PMA_ConfigFile_Test extends PHPUnit_Framework_TestCase
$this->assertEquals(
$cfg_db['Servers'][1]['port'],
$this->object->getDbEntry('Servers/1/port'));
$this->object->getDbEntry('Servers/1/port')
);
$this->assertNull($this->object->getDbEntry('no such key'));
$this->assertEquals(
array(1),
$this->object->getDbEntry('no such key', array(1)));
$this->object->getDbEntry('no such key', array(1))
);
}
/**
@ -476,37 +502,41 @@ class PMA_ConfigFile_Test extends PHPUnit_Framework_TestCase
$this->object->getServerDSN(1)
);
$this->object->updateWithGlobalConfig(array(
'Servers' => array(
1 => array(
"extension" => "mysqli",
"auth_type" => "config",
"user" => "testUser",
"connect_type" => "tcp",
"host" => "example.com",
"port" => "21"
$this->object->updateWithGlobalConfig(
array(
'Servers' => array(
1 => array(
"extension" => "mysqli",
"auth_type" => "config",
"user" => "testUser",
"connect_type" => "tcp",
"host" => "example.com",
"port" => "21"
)
)
)
));
);
$this->assertEquals(
"mysqli://testUser:***@example.com:21",
$this->object->getServerDSN(1)
);
$this->object->updateWithGlobalConfig(array(
'Servers' => array(
1 => array(
"extension" => "mysql",
"auth_type" => "config",
"user" => "testUser",
"connect_type" => "socket",
"host" => "example.com",
"port" => "21",
"nopassword" => "yes",
"socket" => "123"
$this->object->updateWithGlobalConfig(
array(
'Servers' => array(
1 => array(
"extension" => "mysql",
"auth_type" => "config",
"user" => "testUser",
"connect_type" => "socket",
"host" => "example.com",
"port" => "21",
"nopassword" => "yes",
"socket" => "123"
)
)
)
));
);
$this->assertEquals(
"mysql://testUser@123",
$this->object->getServerDSN(1)
@ -560,7 +590,9 @@ class PMA_ConfigFile_Test extends PHPUnit_Framework_TestCase
{
$this->object->setPersistKeys(array(self::SIMPLE_KEY_WITH_DEFAULT_VALUE));
$this->object->set('Array/test', array('x', 'y'));
$default_value = $this->object->getDefault(self::SIMPLE_KEY_WITH_DEFAULT_VALUE);
$default_value = $this->object->getDefault(
self::SIMPLE_KEY_WITH_DEFAULT_VALUE
);
$this->assertEquals(
array(

View File

@ -9,8 +9,8 @@
/*
* Include to test
*/
include_once 'libraries/php-gettext/gettext.inc';
include_once 'libraries/sanitizing.lib.php';
require_once 'libraries/php-gettext/gettext.inc';
require_once 'libraries/sanitizing.lib.php';
require_once 'libraries/config/config_functions.lib.php';
require_once 'libraries/config/ConfigFile.class.php';
require_once 'libraries/core.lib.php';