added testcase for PMA_get_real_size_test.php()
This commit is contained in:
44
test/AllTests.php
Normal file
44
test/AllTests.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
/**
|
||||
* runs all defined tests
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
if (! defined('PMA_MAIN_METHOD')) {
|
||||
define('PMA_MAIN_METHOD', 'AllTests::main');
|
||||
chdir('..');
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
require_once 'PHPUnit/Framework.php';
|
||||
require_once 'PHPUnit/TextUI/TestRunner.php';
|
||||
require_once './test/FailTest.php';
|
||||
require_once './test/PMA_get_real_size_test.php';
|
||||
|
||||
class AllTests
|
||||
{
|
||||
public static function main()
|
||||
{
|
||||
PHPUnit_TextUI_TestRunner::run(self::suite());
|
||||
}
|
||||
|
||||
public static function suite()
|
||||
{
|
||||
$suite = new PHPUnit_Framework_TestSuite('phpMyAdmin');
|
||||
|
||||
//$suite->addTestSuite('FailTest');
|
||||
$suite->addTestSuite('PMA_get_real_size_test');
|
||||
|
||||
return $suite;
|
||||
}
|
||||
}
|
||||
|
||||
if (PMA_MAIN_METHOD == 'AllTests::main') {
|
||||
AllTests::main();
|
||||
}
|
||||
?>
|
22
test/FailTest.php
Normal file
22
test/FailTest.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
* tests for PMA_get_real_size()
|
||||
*
|
||||
* @version $Id: $
|
||||
* @package phpMyAdmin-test
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
require_once 'PHPUnit/Framework.php';
|
||||
require_once './libraries/common.lib.php';
|
||||
|
||||
class FailTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testFail()
|
||||
{
|
||||
$this->assertEquals(0, 1);
|
||||
}
|
||||
}
|
||||
?>
|
42
test/PMA_get_real_size_test.php
Normal file
42
test/PMA_get_real_size_test.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/**
|
||||
* tests for PMA_get_real_size()
|
||||
*
|
||||
* @version $Id: $
|
||||
* @package phpMyAdmin-test
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
require_once 'PHPUnit/Framework.php';
|
||||
require_once './libraries/common.lib.php';
|
||||
|
||||
class PMA_get_real_size_test extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testNull()
|
||||
{
|
||||
$this->assertEquals(0, PMA_get_real_size('0'));
|
||||
}
|
||||
|
||||
public function testKilobyte()
|
||||
{
|
||||
$this->assertEquals(1024, PMA_get_real_size('1kb'));
|
||||
}
|
||||
|
||||
public function testKilobyte2()
|
||||
{
|
||||
$this->assertEquals(1024 * 1024, PMA_get_real_size('1024k'));
|
||||
}
|
||||
|
||||
public function testMegabyte()
|
||||
{
|
||||
$this->assertEquals(8 * 1024 * 1024, PMA_get_real_size('8m'));
|
||||
}
|
||||
|
||||
public function testGigabyte()
|
||||
{
|
||||
$this->assertEquals(12 * 1024 * 1024 * 1024, PMA_get_real_size('12gb'));
|
||||
}
|
||||
}
|
||||
?>
|
Reference in New Issue
Block a user