Move the rest of the tests related to objects under a common parent test

Signed-off-by: Madhura Jayaratne <madhura.cj@gmail.com>
This commit is contained in:
Madhura Jayaratne 2015-12-18 21:32:34 +11:00
parent b67f746bef
commit 2b7cfb595d
35 changed files with 83 additions and 60 deletions

View File

@ -12,6 +12,7 @@
require_once 'libraries/php-gettext/gettext.inc';
require_once 'libraries/url_generating.lib.php';
require_once 'libraries/core.lib.php';
require_once 'test/PMATestCase.php';
use PMA\libraries\Advisor;
use PMA\libraries\Theme;
@ -21,7 +22,7 @@ use PMA\libraries\Theme;
*
* @package PhpMyAdmin-test
*/
class AdvisorTest extends PHPUnit_Framework_TestCase
class AdvisorTest extends PMATestCase
{
/**
@ -34,7 +35,6 @@ class AdvisorTest extends PHPUnit_Framework_TestCase
{
$_SESSION['PMA_Theme'] = Theme::load('./themes/pmahomme');
$GLOBALS['server'] = 0;
$GLOBALS['cfg']['ServerDefault'] = '';
}
/**

View File

@ -14,15 +14,15 @@ use PMA\libraries\config\ConfigFile;
use PMA\setup\lib\ConfigGenerator;
require_once 'libraries/core.lib.php';
require_once 'libraries/php-gettext/gettext.inc';
require_once 'test/PMATestCase.php';
/**
* Tests for PMA\setup\lib\ConfigGenerator
*
* @package PhpMyAdmin-test
*/
class ConfigGeneratorTest extends PHPUnit_Framework_TestCase
class ConfigGeneratorTest extends PMATestCase
{
/**
@ -33,7 +33,6 @@ class ConfigGeneratorTest extends PHPUnit_Framework_TestCase
*/
public function testGetConfigFile()
{
$GLOBALS['cfg']['AvailableCharsets'] = array();
unset($_SESSION['eol']);
$GLOBALS['PMA_Config'] = new Config();

View File

@ -17,13 +17,14 @@ require_once 'libraries/relation.lib.php';
require_once 'libraries/vendor_config.php';
require_once 'libraries/url_generating.lib.php';
require_once 'libraries/php-gettext/gettext.inc';
require_once 'test/PMATestCase.php';
/**
* Tests behaviour of PMA\libraries\Config class
*
* @package PhpMyAdmin-test
*/
class ConfigTest extends PHPUnit_Framework_TestCase
class ConfigTest extends PMATestCase
{
/**
* Turn off backup globals

View File

@ -6,12 +6,14 @@
* @package PhpMyAdmin-test
*/
require_once 'test/PMATestCase.php';
/**
* Tests basic functionality of dummy dbi driver
*
* @package PhpMyAdmin-test
*/
class DatabaseInterfaceTest extends PHPUnit_Framework_TestCase
class DatabaseInterfaceTest extends PMATestCase
{
private $_dbi;

View File

@ -13,6 +13,7 @@ require_once 'libraries/php-gettext/gettext.inc';
require_once 'libraries/core.lib.php';
require_once 'libraries/database_interface.inc.php';
require_once 'libraries/relation.lib.php';
require_once 'test/PMATestCase.php';
use PMA\libraries\DbQbe;
@ -21,7 +22,7 @@ use PMA\libraries\DbQbe;
*
* @package PhpMyAdmin-test
*/
class DbQbeTest extends PHPUnit_Framework_TestCase
class DbQbeTest extends PMATestCase
{
/**
* @access protected

View File

@ -13,6 +13,7 @@ require_once 'libraries/php-gettext/gettext.inc';
require_once 'libraries/url_generating.lib.php';
require_once 'libraries/core.lib.php';
require_once 'libraries/database_interface.inc.php';
require_once 'test/PMATestCase.php';
use PMA\libraries\DbSearch;
use PMA\libraries\Theme;
@ -22,7 +23,7 @@ use PMA\libraries\Theme;
*
* @package PhpMyAdmin-test
*/
class DbSearchTest extends PHPUnit_Framework_TestCase
class DbSearchTest extends PMATestCase
{
/**
* @access protected
@ -40,8 +41,6 @@ class DbSearchTest extends PHPUnit_Framework_TestCase
{
$this->object = new DbSearch('pma_test');
$GLOBALS['server'] = 0;
$GLOBALS['cfg']['ServerDefault'] = 1;
$GLOBALS['cfg']['ShowHint'] = true;
$GLOBALS['db'] = 'pma';
}

View File

@ -16,13 +16,14 @@ require_once 'libraries/js_escape.lib.php';
require_once 'libraries/core.lib.php';
require_once 'libraries/relation.lib.php';
require_once 'libraries/string.lib.php';
require_once 'test/PMATestCase.php';
/**
* Test cases for displaying results.
*
* @package PhpMyAdmin-test
*/
class DisplayResultsTest extends PHPUnit_Framework_TestCase
class DisplayResultsTest extends PMATestCase
{
/**
* @access protected

View File

@ -12,13 +12,14 @@
use PMA\libraries\Theme;
require_once 'libraries/sanitizing.lib.php';
require_once 'test/PMATestCase.php';
/**
* Test for PMA\libraries\ErrorHandler class.
*
* @package PhpMyAdmin-test
*/
class ErrorHandlerTest extends PHPUnit_Framework_TestCase
class ErrorHandlerTest extends PMATestCase
{
/**
* @access protected

View File

@ -13,13 +13,14 @@
use PMA\libraries\Theme;
require_once 'libraries/sanitizing.lib.php';
require_once 'test/PMATestCase.php';
/**
* Error class testing.
*
* @package PhpMyAdmin-test
*/
class ErrorTest extends PHPUnit_Framework_TestCase
class ErrorTest extends PMATestCase
{
/**
* @access protected

View File

@ -6,12 +6,14 @@
* @package PhpMyAdmin-test
*/
require_once 'test/PMATestCase.php';
/**
* tests for PMA\libraries\File class
*
* @package PhpMyAdmin-test
*/
class FileTest extends PHPUnit_Framework_TestCase
class FileTest extends PMATestCase
{
/**
* Setup function for test cases
@ -20,9 +22,6 @@ class FileTest extends PHPUnit_Framework_TestCase
*/
public function setup()
{
$GLOBALS['cfg']['BZipDump'] = true;
$GLOBALS['cfg']['GZipDump'] = true;
$GLOBALS['cfg']['ZipDump'] = true;
$GLOBALS['charset_conversion'] = false;
}

View File

@ -5,12 +5,14 @@
* @package PhpMyAdmin-test
*/
require_once 'test/PMATestCase.php';
/**
* Tests for PMA\libraries\Font class
*
* @package PhpMyAdmin-test
*/
class FontTest extends PHPUnit_Framework_TestCase
class FontTest extends PMATestCase
{
/**
* Test getStringWidth with different characters.

View File

@ -17,13 +17,14 @@ require_once 'libraries/url_generating.lib.php';
require_once 'libraries/php-gettext/gettext.inc';
require_once 'libraries/vendor_config.php';
require_once 'libraries/relation.lib.php';
require_once 'test/PMATestCase.php';
/**
* Tests for Footer class
*
* @package PhpMyAdmin-test
*/
class FooterTest extends PHPUnit_Framework_TestCase
class FooterTest extends PMATestCase
{
/**
@ -55,7 +56,6 @@ class FooterTest extends PHPUnit_Framework_TestCase
$GLOBALS['PMA_Config']->enableBc();
$GLOBALS['collation_connection'] = 'utf8_general_ci';
$GLOBALS['cfg']['Server']['verbose'] = 'verbose host';
$GLOBALS['cfg']['DefaultTabDatabase'] = 'structure';
$GLOBALS['server'] = '1';
$_GET['reload_left_frame'] = '1';
$GLOBALS['focus_querywindow'] = 'main_pane_left';

View File

@ -19,6 +19,7 @@ require_once 'libraries/vendor_config.php';
require_once 'libraries/select_lang.inc.php';
require_once 'libraries/relation.lib.php';
require_once 'libraries/js_escape.lib.php';
require_once 'test/PMATestCase.php';
/**
* Test for PMA\libraries\Header class
@ -26,7 +27,7 @@ require_once 'libraries/js_escape.lib.php';
* @package PhpMyAdmin-test
* @group medium
*/
class HeaderTest extends PHPUnit_Framework_TestCase
class HeaderTest extends PMATestCase
{
/**
* Configures global environment.

View File

@ -10,13 +10,14 @@
* Include to test.
*/
require_once 'libraries/php-gettext/gettext.inc';
require_once 'test/PMATestCase.php';
/**
* Test for Index class
*
* @package PhpMyAdmin-test
*/
class IndexTest extends PHPUnit_Framework_TestCase
class IndexTest extends PMATestCase
{
private $_params = array();

View File

@ -11,12 +11,14 @@
*/
use PMA\libraries\Linter;
require_once 'test/PMATestCase.php';
/**
* Tests for PMA\libraries\Linter
*
* @package PhpMyAdmin-test
*/
class LinterTest extends PHPUnit_Framework_TestCase
class LinterTest extends PMATestCase
{
/**

View File

@ -14,13 +14,14 @@ $GLOBALS['cfg']['Server']['DisableIS'] = false;
* Include to test.
*/
require_once 'libraries/relation.lib.php';
require_once 'test/PMATestCase.php';
/**
* tests for ListDatabase class
*
* @package PhpMyAdmin-test
*/
class ListDatabaseTest extends PHPUnit_Framework_TestCase
class ListDatabaseTest extends PMATestCase
{
/**
* SetUp for test cases

View File

@ -19,13 +19,14 @@ require_once 'libraries/url_generating.lib.php';
require_once 'libraries/vendor_config.php';
require_once 'libraries/select_lang.inc.php';
require_once 'libraries/relation.lib.php';
require_once 'test/PMATestCase.php';
/**
* Test for Menu class
*
* @package PhpMyAdmin-test
*/
class MenuTest extends PHPUnit_Framework_TestCase
class MenuTest extends PMATestCase
{
/**
* Configures global environment.
@ -39,19 +40,10 @@ class MenuTest extends PHPUnit_Framework_TestCase
}
$GLOBALS['cfg']['Server']['DisableIS'] = false;
$GLOBALS['server'] = 0;
$GLOBALS['cfg']['ServerDefault'] = 1;
$GLOBALS['cfg']['Server']['verbose'] = 'verbose host';
$GLOBALS['cfg']['TableNavigationLinksMode'] = 'both';
$_SESSION['PMA_Theme'] = new Theme();
$GLOBALS['pmaThemePath'] = $_SESSION['PMA_Theme']->getPath();
$GLOBALS['pmaThemeImage'] = 'theme/';
$GLOBALS['cfg']['DefaultTabServer'] = 'welcome';
$GLOBALS['cfg']['DefaultTabDatabase'] = 'structure';
$GLOBALS['cfg']['DefaultTabTable'] = 'browse';
$GLOBALS['cfg']['OBGzip'] = false;
$GLOBALS['cfg']['NaturalOrder'] = true;
$GLOBALS['cfg']['TabsMode'] = 'both';
$GLOBALS['cfg']['DBG']['sql'] = false;
$GLOBALS['PMA_PHP_SELF'] = PMA_getenv('PHP_SELF');
$GLOBALS['server'] = 'server';
$GLOBALS['db'] = 'pma_test';

View File

@ -14,13 +14,14 @@ use PMA\libraries\Theme;
require_once 'libraries/sanitizing.lib.php';
require_once 'libraries/core.lib.php';
require_once 'libraries/php-gettext/gettext.inc';
require_once 'test/PMATestCase.php';
/**
* Test for Message class
*
* @package PhpMyAdmin-test
*/
class MessageTest extends PHPUnit_Framework_TestCase
class MessageTest extends PMATestCase
{
/**
* @var PMA\libraries\Message

View File

@ -13,13 +13,14 @@ use PMA\libraries\PDF;
require_once 'libraries/php-gettext/gettext.inc';
require_once 'libraries/core.lib.php';
require_once 'test/PMATestCase.php';
/**
* tests for PDF class
*
* @package PhpMyAdmin-test
*/
class PDFTest extends PHPUnit_Framework_TestCase
class PDFTest extends PMATestCase
{
/**
* SetUp for test cases

View File

@ -11,12 +11,14 @@
*/
use PMA\libraries\PMA_String;
require_once 'test/PMATestCase.php';
/**
* Tests for PMA\libraries\PMA_String
*
* @package PhpMyAdmin-test
*/
class PMA_StringClassTest extends PHPUnit_Framework_TestCase
class PMA_StringClassTest extends PMATestCase
{
/**
* @var String

View File

@ -14,13 +14,14 @@ use PMA\libraries\Scripts;
require_once 'libraries/js_escape.lib.php';
require_once 'libraries/url_generating.lib.php';
require_once 'test/PMATestCase.php';
/**
* Tests for Script.php
*
* @package PhpMyAdmin-test
*/
class ScriptsTest extends PHPUnit_Framework_TestCase
class ScriptsTest extends PMATestCase
{
/**
* @access protected

View File

@ -14,13 +14,14 @@ use PMA\libraries\ServerStatusData;
require_once 'libraries/php-gettext/gettext.inc';
require_once 'libraries/url_generating.lib.php';
require_once 'libraries/database_interface.inc.php';
require_once 'test/PMATestCase.php';
/**
* Test for ServerStatusData class
*
* @package PhpMyAdmin-test
*/
class ServerStatusDataTest extends PHPUnit_Framework_TestCase
class ServerStatusDataTest extends PMATestCase
{
/**
* @access protected

View File

@ -11,12 +11,14 @@
*/
use PMA\libraries\StringCType;
require_once 'test/PMATestCase.php';
/**
* Tests for PMA\libraries\StringCType
*
* @package PhpMyAdmin-test
*/
class StringCTypeTest extends PHPUnit_Framework_TestCase
class StringCTypeTest extends PMATestCase
{
private $_object;

View File

@ -11,12 +11,14 @@
*/
use PMA\libraries\StringNativeType;
require_once 'test/PMATestCase.php';
/**
* Tests for PMA\libraries\StringNativeType
*
* @package PhpMyAdmin-test
*/
class StringNativeTypeTest extends PHPUnit_Framework_TestCase
class StringNativeTypeTest extends PMATestCase
{
private $_object;

View File

@ -6,12 +6,14 @@
* @package PhpMyAdmin-test
*/
require_once 'test/PMATestCase.php';
/**
* Tests for libraries/SystemDatabase.php
*
* @package PhpMyAdmin-test
*/
class SystemDatabaseTest extends PHPUnit_Framework_TestCase
class SystemDatabaseTest extends PMATestCase
{
/**
* Setup function for test cases

View File

@ -18,13 +18,14 @@ require_once 'libraries/database_interface.inc.php';
require_once 'libraries/php-gettext/gettext.inc';
require_once 'libraries/url_generating.lib.php';
require_once 'libraries/relation.lib.php';
require_once 'test/PMATestCase.php';
/**
* Tests behaviour of Table class
*
* @package PhpMyAdmin-test
*/
class TableTest extends PHPUnit_Framework_TestCase
class TableTest extends PMATestCase
{
/**
* Configures environment
@ -38,10 +39,6 @@ class TableTest extends PHPUnit_Framework_TestCase
*/
$GLOBALS['server'] = 0;
$GLOBALS['cfg']['Server']['DisableIS'] = false;
$GLOBALS['cfg']['ServerDefault'] = 1;
$GLOBALS['cfg']['ActionLinksMode'] = 'both';
$GLOBALS['cfg']['MaxExactCount'] = 100;
$GLOBALS['cfg']['MaxExactCountViews'] = 100;
$GLOBALS['cfg']['Server']['pmadb'] = "pmadb";
$GLOBALS['sql_auto_increment'] = true;
$GLOBALS['sql_if_not_exists'] = true;

View File

@ -6,12 +6,14 @@
* @package PhpMyAdmin-test
*/
require_once 'test/PMATestCase.php';
/**
* Test for PMA\libraries\Template class
*
* @package PhpMyAdmin-test
*/
class TemplateTest extends PHPUnit_Framework_TestCase
class TemplateTest extends PMATestCase
{
/**
* Test for render

View File

@ -14,13 +14,14 @@ use PMA\libraries\ThemeManager;
require_once 'libraries/url_generating.lib.php';
require_once 'libraries/php-gettext/gettext.inc';
require_once 'libraries/core.lib.php';
require_once 'test/PMATestCase.php';
/**
* tests for ThemeManager class
*
* @package PhpMyAdmin-test
*/
class ThemeManagerTest extends PHPUnit_Framework_TestCase
class ThemeManagerTest extends PMATestCase
{
/**
* SetUp for test cases

View File

@ -10,13 +10,14 @@ use PMA\libraries\Theme;
require_once 'libraries/core.lib.php';
require_once 'libraries/php-gettext/gettext.inc';
require_once 'libraries/url_generating.lib.php';
require_once 'test/PMATestCase.php';
/**
* Test class for Theme.
*
* @package PhpMyAdmin-test
*/
class ThemeTest extends PHPUnit_Framework_TestCase
class ThemeTest extends PMATestCase
{
/**
* @var Theme

View File

@ -14,13 +14,14 @@ use PMA\libraries\Tracker;
require_once 'libraries/database_interface.inc.php';
require_once 'libraries/php-gettext/gettext.inc';
require_once 'libraries/relation.lib.php';
require_once 'test/PMATestCase.php';
/**
* Tests for PMA\libraries\Tracker
*
* @package PhpMyAdmin-test
*/
class TrackerTest extends PHPUnit_Framework_TestCase
class TrackerTest extends PMATestCase
{
/**
@ -41,7 +42,6 @@ class TrackerTest extends PHPUnit_Framework_TestCase
$GLOBALS['cfg']['Server']['tracking_default_statements'] = '';
$GLOBALS['cfg']['Server']['tracking_version_auto_create'] = '';
$GLOBALS['cfg']['Server']['DisableIS'] = false;
$GLOBALS['cfg']['DBG']['sql'] = false;
$_SESSION['relation'][$GLOBALS['server']] = array(
'PMA_VERSION' => PMA_VERSION,

View File

@ -12,13 +12,14 @@
use PMA\libraries\TypesMySQL;
require_once 'libraries/php-gettext/gettext.inc';
require_once 'test/PMATestCase.php';
/**
* Testcase for MySQL types handling.
*
* @package PhpMyAdmin-test
*/
class TypesMySQLTest extends PHPUnit_Framework_TestCase
class TypesMySQLTest extends PMATestCase
{
/**
* @var PMA\libraries\Types

View File

@ -6,12 +6,14 @@
*/
use PMA\libraries\Types;
require_once 'test/PMATestCase.php';
/**
* Test class for Types.
*
* @package PhpMyAdmin-test
*/
class TypesTest extends PHPUnit_Framework_TestCase
class TypesTest extends PMATestCase
{
/**
* @var Types

View File

@ -6,12 +6,14 @@
* @package PhpMyAdmin-test
*/
require_once 'test/PMATestCase.php';
/**
* Test for PMA\libraries\Util class
*
* @package PhpMyAdmin-test
*/
class UtilTest extends PHPUnit_Framework_TestCase
class UtilTest extends PMATestCase
{
/**
@ -74,8 +76,6 @@ class UtilTest extends PHPUnit_Framework_TestCase
public function testIsForeignKeyCheck()
{
$GLOBALS['server'] = 1;
$GLOBALS['cfg']['DBG'] = array();
$GLOBALS['cfg']['DBG']['sql'] = false;
$GLOBALS['cfg']['DefaultForeignKeyChecks'] = 'enable';
$this->assertEquals(

View File

@ -11,12 +11,14 @@
*/
use PMA\libraries\VersionInformation;
require_once 'test/PMATestCase.php';
/**
* Tests for methods in PMA\libraries\VersionInformation class
*
* @package PhpMyAdmin-test
*/
class VersionInformationTest extends PHPUnit_Framework_TestCase
class VersionInformationTest extends PMATestCase
{
private $_releases;

View File

@ -7,12 +7,14 @@
use PMA\libraries\ZipFile;
require_once 'test/PMATestCase.php';
/**
* Tests for PMA\libraries\ZipFile
*
* @package PhpMyAdmin-test
*/
class ZipFileTest extends PHPUnit_Framework_TestCase
class ZipFileTest extends PMATestCase
{
/**
* @access protected