Fix some failing tests

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
This commit is contained in:
Maurício Meneghini Fauth 2021-06-13 15:01:07 -03:00
parent b6c28f162d
commit a96be01b6d
No known key found for this signature in database
GPG Key ID: 6A16FD38AFC89CC8
6 changed files with 19 additions and 19 deletions

View File

@ -30,7 +30,7 @@ $GLOBALS['server'] = 0;
define('PMA_PATH_TO_BASEDIR', '');
define('PMA_USR_BROWSER_AGENT', 'CHROME');
define('PMA_USR_BROWSER_VER', 1);
define('PMA_USR_OS', 'os');
define('PMA_USR_OS', 'Other');
define('PMA_IS_WINDOWS', false);
// phpcs:enable

View File

@ -11,8 +11,6 @@ use PhpMyAdmin\Template;
use PhpMyAdmin\Utils\HttpRequest;
use PhpMyAdmin\Version;
use function define;
use function defined;
use function htmlspecialchars;
use function json_encode;
use function phpversion;
@ -41,18 +39,7 @@ class ErrorReportTest extends AbstractTestCase
$_SERVER['HTTP_USER_AGENT'] = 'HTTP_USER_AGENT';
$_COOKIE['pma_lang'] = 'en';
$GLOBALS['config']->set('is_https', false);
if (! defined('PMA_USR_BROWSER_AGENT')) {
define('PMA_USR_BROWSER_AGENT', 'Other');
}
if (! defined('PMA_USR_BROWSER_VER')) {
define('PMA_USR_BROWSER_VER', 1);
}
if (! defined('PMA_USR_OS')) {
define('PMA_USR_OS', 'os');
}
$GLOBALS['config']->enableBc();
$template = new Template();
$this->errorReport = new ErrorReport(

View File

@ -142,10 +142,19 @@ class NormalizationTest extends AbstractTestCase
$GLOBALS['cfg']['BrowseMIME'] = true;
$GLOBALS['cfg']['MaxRows'] = 25;
$GLOBALS['col_priv'] = false;
$db = 'PMA_db';
$table = 'PMA_table';
$GLOBALS['cfg']['Server']['DisableIS'] = false;
$GLOBALS['dbi'] = $this->dbi;
$db = 'testdb';
$table = 'mytable';
$numFields = 1;
$result = $this->normalization->getHtmlForCreateNewColumn($numFields, $db, $table);
$template = new Template();
$normalization = new Normalization(
$this->dbi,
new Relation($this->dbi, $template),
new Transformations(),
$template
);
$result = $normalization->getHtmlForCreateNewColumn($numFields, $db, $table);
$this->assertStringContainsString(
'<table id="table_columns"',
$result

View File

@ -1845,6 +1845,7 @@ class PrivilegesTest extends AbstractTestCase
*/
public function testGetHtmlForUserOverview(): void
{
$_REQUEST = ['ajax_page_request' => '1'];
$actual = $this->serverPrivileges->getHtmlForUserOverview('ltr');
$this->assertStringContainsString(
'Note: MySQL privilege names are expressed in English.',

View File

@ -8,6 +8,7 @@ use PhpMyAdmin\Core;
use PhpMyAdmin\DatabaseInterface;
use PhpMyAdmin\FieldMetadata;
use PhpMyAdmin\MoTranslator\Loader;
use PhpMyAdmin\Response;
use PhpMyAdmin\SqlParser\Context;
use PhpMyAdmin\SqlParser\Token;
use PhpMyAdmin\Util;
@ -343,6 +344,7 @@ class UtilTest extends AbstractTestCase
public function testCheckParameterMissing(): void
{
parent::setGlobalConfig();
$_REQUEST = [];
$GLOBALS['text_dir'] = 'ltr';
$GLOBALS['PMA_PHP_SELF'] = Core::getenv('PHP_SELF');
$GLOBALS['db'] = 'db';
@ -350,6 +352,7 @@ class UtilTest extends AbstractTestCase
$GLOBALS['server'] = 1;
$GLOBALS['cfg']['ServerDefault'] = 1;
$GLOBALS['cfg']['AllowThirdPartyFraming'] = false;
Response::getInstance()->setAjax(false);
$this->expectOutputRegex('/Missing parameter: field/');

View File

@ -5,7 +5,7 @@ declare(strict_types=1);
define('ROOT_PATH', dirname(__DIR__) . DIRECTORY_SEPARATOR);
define('PMA_USR_BROWSER_AGENT', 'Other');
define('PMA_USR_BROWSER_VER', 1);
define('PMA_USR_OS', 'os');
define('PMA_USR_OS', 'Other');
define('PMA_IS_WINDOWS', false);
define('CACHE_DIR', ROOT_PATH . 'libraries' . DIRECTORY_SEPARATOR . 'cache' . DIRECTORY_SEPARATOR);
define('VERSION_SUFFIX', '');