Initial commit
This commit is contained in:
119
#pma/test/classes/UtilTest.php
Normal file
119
#pma/test/classes/UtilTest.php
Normal file
@ -0,0 +1,119 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* Test for PMA\libraries\Util class
|
||||
*
|
||||
* @package PhpMyAdmin-test
|
||||
*/
|
||||
|
||||
require_once 'test/PMATestCase.php';
|
||||
|
||||
/**
|
||||
* Test for PMA\libraries\Util class
|
||||
*
|
||||
* @package PhpMyAdmin-test
|
||||
*/
|
||||
class UtilTest extends PMATestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* Test for createGISData
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testCreateGISData()
|
||||
{
|
||||
$this->assertEquals(
|
||||
"abc",
|
||||
PMA\libraries\Util::createGISData("abc")
|
||||
);
|
||||
$this->assertEquals(
|
||||
"GeomFromText('POINT()',10)",
|
||||
PMA\libraries\Util::createGISData("'POINT()',10")
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for getGISFunctions
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testGetGISFunctions()
|
||||
{
|
||||
$funcs = PMA\libraries\Util::getGISFunctions();
|
||||
$this->assertArrayHasKey(
|
||||
'Dimension',
|
||||
$funcs
|
||||
);
|
||||
$this->assertArrayHasKey(
|
||||
'GeometryType',
|
||||
$funcs
|
||||
);
|
||||
$this->assertArrayHasKey(
|
||||
'MBRDisjoint',
|
||||
$funcs
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for Page Selector
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testPageSelector()
|
||||
{
|
||||
$this->assertContains(
|
||||
'<select class="pageselector ajax" name="pma" >',
|
||||
PMA\libraries\Util::pageselector("pma", 3)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for isForeignKeyCheck
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testIsForeignKeyCheck()
|
||||
{
|
||||
$GLOBALS['server'] = 1;
|
||||
|
||||
$GLOBALS['cfg']['DefaultForeignKeyChecks'] = 'enable';
|
||||
$this->assertEquals(
|
||||
true,
|
||||
PMA\libraries\Util::isForeignKeyCheck()
|
||||
);
|
||||
|
||||
$GLOBALS['cfg']['DefaultForeignKeyChecks'] = 'disable';
|
||||
$this->assertEquals(
|
||||
false,
|
||||
PMA\libraries\Util::isForeignKeyCheck()
|
||||
);
|
||||
|
||||
$GLOBALS['cfg']['DefaultForeignKeyChecks'] = 'default';
|
||||
$this->assertEquals(
|
||||
true,
|
||||
PMA\libraries\Util::isForeignKeyCheck()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for isForeignKeySupported
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testIsForeignKeySupported()
|
||||
{
|
||||
$GLOBALS['server'] = 1;
|
||||
|
||||
$this->assertTrue(
|
||||
PMA\libraries\Util::isForeignKeySupported('innodb')
|
||||
);
|
||||
$this->assertFalse(
|
||||
PMA\libraries\Util::isForeignKeySupported('myisam')
|
||||
);
|
||||
$this->assertTrue(
|
||||
PMA\libraries\Util::isForeignKeySupported('ndb')
|
||||
);
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user