Merge pull request #439 from ayushchd/unit_testing
Unit tests for ctype and native string classes
This commit is contained in:
commit
e6b07a94d8
@ -39,7 +39,7 @@ class PMA_StringNativeType
|
||||
*/
|
||||
public static function isAlpha($c)
|
||||
{
|
||||
return ($GLOBALS['PMA_StringType']::isUpper($c) || $GLOBALS['PMA_StringType']::isLower($c));
|
||||
return (self::isUpper($c) || self::isLower($c));
|
||||
} // end of the "isAlpha()" function
|
||||
|
||||
/**
|
||||
|
||||
261
test/libraries/PMA_StringCType_test.php
Normal file
261
test/libraries/PMA_StringCType_test.php
Normal file
@ -0,0 +1,261 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* Tests for Specialized String Class (CType) for phpMyAdmin
|
||||
*
|
||||
* @package PhpMyAdmin-test
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include to test.
|
||||
*/
|
||||
require_once 'libraries/StringCType.class.php';
|
||||
|
||||
/**
|
||||
* Tests for Specialized String Class (CType) for phpMyAdmin
|
||||
*
|
||||
* @package PhpMyAdmin-test
|
||||
*/
|
||||
class PMA_StringCType_Test extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* Setup function for test cases
|
||||
*
|
||||
* @access protected
|
||||
* @return void
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
if (!@extension_loaded('ctype')) {
|
||||
$this->markTestSkipped(
|
||||
"ctype extension not present."
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for PMA_StringCType::isAlnum
|
||||
*
|
||||
* @param integer $expected Expected output
|
||||
* @param string $str String to check
|
||||
*
|
||||
* @return void
|
||||
* @test
|
||||
* @dataProvider isAlnumData
|
||||
*/
|
||||
public function testIsAlnum($expected, $str)
|
||||
{
|
||||
$this->assertEquals(
|
||||
$expected,
|
||||
PMA_StringCType::isAlnum($str)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Data provider for testIsAlnum
|
||||
*
|
||||
* @return array Test data
|
||||
*/
|
||||
public function isAlnumData()
|
||||
{
|
||||
return array(
|
||||
array(true, "AbCd1zyZ9"),
|
||||
array(false, "foo!#$bar")
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for PMA_StringCType::isAlpha
|
||||
*
|
||||
* @param integer $expected Expected output
|
||||
* @param string $str String to check
|
||||
*
|
||||
* @return void
|
||||
* @test
|
||||
* @dataProvider isAlphaData
|
||||
*/
|
||||
public function testIsAlpha($expected, $str)
|
||||
{
|
||||
$this->assertEquals(
|
||||
$expected,
|
||||
PMA_StringCType::isAlpha($str)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Data provider for testIsAlpha
|
||||
*
|
||||
* @return array Test data
|
||||
*/
|
||||
public function isAlphaData()
|
||||
{
|
||||
return array(
|
||||
array(true, "kJW"),
|
||||
array(false, "k12"),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for PMA_StringCType::isDigit
|
||||
*
|
||||
* @param integer $expected Expected output
|
||||
* @param string $str String to check
|
||||
*
|
||||
* @return void
|
||||
* @test
|
||||
* @dataProvider isDigitData
|
||||
*/
|
||||
public function testIsDigit($expected, $str)
|
||||
{
|
||||
$this->assertEquals(
|
||||
$expected,
|
||||
PMA_StringCType::isDigit($str)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Data provider for testIsDigit
|
||||
*
|
||||
* @return array Test data
|
||||
*/
|
||||
public function isDigitData()
|
||||
{
|
||||
return array(
|
||||
array(false, "kJW"),
|
||||
array(false, "?.foo!#21"),
|
||||
array(true, "12"),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for PMA_StringCType::isUpper
|
||||
*
|
||||
* @param integer $expected Expected output
|
||||
* @param string $str String to check
|
||||
*
|
||||
* @return void
|
||||
* @test
|
||||
* @dataProvider isUpperData
|
||||
*/
|
||||
public function testIsUpper($expected, $str)
|
||||
{
|
||||
$this->assertEquals(
|
||||
$expected,
|
||||
PMA_StringCType::isUpper($str)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Data provider for testIsUpper
|
||||
*
|
||||
* @return array Test data
|
||||
*/
|
||||
public function isUpperData()
|
||||
{
|
||||
return array(
|
||||
array(true, "ABCD"),
|
||||
array(false, "AbCD"),
|
||||
array(false, "ABCD12!3")
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for PMA_StringCType::isLower
|
||||
*
|
||||
* @param integer $expected Expected output
|
||||
* @param string $str String to check
|
||||
*
|
||||
* @return void
|
||||
* @test
|
||||
* @dataProvider isLowerData
|
||||
*/
|
||||
public function testIsLower($expected, $str)
|
||||
{
|
||||
$this->assertEquals(
|
||||
$expected,
|
||||
PMA_StringCType::isLower($str)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Data provider for testIsLower
|
||||
*
|
||||
* @return array Test data
|
||||
*/
|
||||
public function isLowerData()
|
||||
{
|
||||
return array(
|
||||
array(true, "abcd"),
|
||||
array(false, "aBcd"),
|
||||
array(false, "abcd12!3")
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for PMA_StringCType::isSpace
|
||||
*
|
||||
* @param integer $expected Expected output
|
||||
* @param string $str String to check
|
||||
*
|
||||
* @return void
|
||||
* @test
|
||||
* @dataProvider isSpaceData
|
||||
*/
|
||||
public function testIsSpace($expected, $str)
|
||||
{
|
||||
$this->assertEquals(
|
||||
$expected,
|
||||
PMA_StringCType::isSpace($str)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Data provider for testIsSpace
|
||||
*
|
||||
* @return array Test data
|
||||
*/
|
||||
public function isSpaceData()
|
||||
{
|
||||
return array(
|
||||
array(true, " "),
|
||||
array(false, '\n\r\t'),
|
||||
array(true, "\n\r\t"),
|
||||
array(false, "\ntest"),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for PMA_StringCType::isHexDigit
|
||||
*
|
||||
* @param integer $expected Expected output
|
||||
* @param string $str String to check
|
||||
*
|
||||
* @return void
|
||||
* @test
|
||||
* @dataProvider isHexDigitData
|
||||
*/
|
||||
public function testIsHexDigit($expected, $str)
|
||||
{
|
||||
$this->assertEquals(
|
||||
$expected,
|
||||
PMA_StringCType::isHexDigit($str)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Data provider for testIsHexDigit
|
||||
*
|
||||
* @return array Test data
|
||||
*/
|
||||
public function isHexDigitData()
|
||||
{
|
||||
return array(
|
||||
array(true, "AB10BC99"),
|
||||
array(false, "AR1012"),
|
||||
array(true, "ab12bc99")
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
@ -10,13 +10,14 @@
|
||||
* Include to test.
|
||||
*/
|
||||
require_once 'libraries/StringMB.class.php';
|
||||
require_once 'test/libraries/PMA_StringNative_test.php';
|
||||
|
||||
/**
|
||||
* Tests for Specialized String Functions (multi-byte) for phpMyAdmin
|
||||
*
|
||||
* @package PhpMyAdmin-test
|
||||
*/
|
||||
class PMA_String_Mb_Test extends PHPUnit_Framework_TestCase
|
||||
class PMA_String_Mb_Test extends PMA_StringNative_Test
|
||||
{
|
||||
protected $internal_encoding;
|
||||
|
||||
@ -28,7 +29,14 @@ class PMA_String_Mb_Test extends PHPUnit_Framework_TestCase
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
$this->internal_encoding = mb_internal_encoding();
|
||||
if (@function_exists('mb_strlen')) {
|
||||
$this->internal_encoding = mb_internal_encoding();
|
||||
$this->testClass = new PMA_StringMB;
|
||||
} else {
|
||||
$this->markTestSkipped(
|
||||
"Multibyte functions don't exist, skipping test."
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -39,146 +47,9 @@ class PMA_String_Mb_Test extends PHPUnit_Framework_TestCase
|
||||
*/
|
||||
protected function tearDown()
|
||||
{
|
||||
mb_internal_encoding($this->internal_encoding);
|
||||
if (isset($this->internal_encoding)) {
|
||||
mb_internal_encoding($this->internal_encoding);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for PMA_StringMB::strlen
|
||||
*
|
||||
* @param integer $length Length of the string
|
||||
* @param string $str String to check for
|
||||
* @param string $encoding Encoding of the string
|
||||
*
|
||||
* @return void
|
||||
* @test
|
||||
* @dataProvider mbStrlenData
|
||||
*/
|
||||
public function testMbStrlen($length, $str, $encoding)
|
||||
{
|
||||
mb_internal_encoding($encoding);
|
||||
$this->assertEquals(
|
||||
$length,
|
||||
PMA_StringMB::strlen($str)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Data provider for testMbStrlen
|
||||
*
|
||||
* @return array Test data
|
||||
*/
|
||||
public function mbStrlenData()
|
||||
{
|
||||
return array(
|
||||
array(2, "ab", "UTF-8"),
|
||||
array(9, "åèö - doo", "UTF-8"),
|
||||
array(12, "åèö - doo", "ISO-8859-1")
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for PMA_StringMB::substr
|
||||
*
|
||||
* @param string $str Expected substring
|
||||
* @param string $haystack String to check in
|
||||
* @param int $start Starting position of substring
|
||||
* @param int $length Length of substring
|
||||
* @param string $encoding Encoding of the string
|
||||
*
|
||||
* @return void
|
||||
* @test
|
||||
* @dataProvider mbSubStrData
|
||||
*/
|
||||
public function testMbSubStr($str, $haystack, $start, $length, $encoding)
|
||||
{
|
||||
mb_internal_encoding($encoding);
|
||||
$this->assertEquals(
|
||||
$str,
|
||||
PMA_StringMB::substr($haystack, $start, $length)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Data provider for testMbSubStr
|
||||
*
|
||||
* @return array Test data
|
||||
*/
|
||||
public function mbSubStrData()
|
||||
{
|
||||
return array(
|
||||
array("b", "ab", 1, 1, "UTF-8"),
|
||||
array("èö", "åèö - doo", 1, 2, "UTF-8"),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for PMA_StringMB::strpos
|
||||
*
|
||||
* @param int $pos Expected position
|
||||
* @param string $haystack String to search in
|
||||
* @param string $needle String to search for
|
||||
* @param int $offset Search offset
|
||||
* @param string $encoding Encoding to test against
|
||||
*
|
||||
* @return void
|
||||
* @test
|
||||
* @dataProvider mbStrposData
|
||||
*/
|
||||
public function testMbStrpos($pos, $haystack, $needle, $offset, $encoding)
|
||||
{
|
||||
mb_internal_encoding($encoding);
|
||||
$this->assertEquals(
|
||||
$pos,
|
||||
PMA_StringMB::strpos($haystack, $needle, $offset)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Data provider for testMbStrpos
|
||||
*
|
||||
* @return array Test data
|
||||
*/
|
||||
public function mbStrposData()
|
||||
{
|
||||
return array(
|
||||
array(1, "ab", "b", 0, "UTF-8"),
|
||||
array(2, "åèö - doo", "ö", 0, "UTF-8"),
|
||||
array(6, "åèöè", "è", 3, "ISO-8859-1")
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for PMA_StringMB::strtolower
|
||||
*
|
||||
* @param string $expected Expected lowercased string
|
||||
* @param string $string String to convert to lowercase
|
||||
* @param string $encoding Encoding to test against
|
||||
*
|
||||
* @return void
|
||||
* @test
|
||||
* @dataProvider mbStrToLowerData
|
||||
*/
|
||||
public function testMbStrToLower($expected, $string, $encoding)
|
||||
{
|
||||
mb_internal_encoding($encoding);
|
||||
$this->assertEquals(
|
||||
$expected,
|
||||
PMA_StringMB::strtolower($string)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Data provider for testMbStrpos
|
||||
*
|
||||
* @return array Test data
|
||||
*/
|
||||
public function mbStrToLowerData()
|
||||
{
|
||||
return array(
|
||||
array("mary had a", "Mary Had A", "UTF-8"),
|
||||
array("τάχιστη", "Τάχιστη", "UTF-8")
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
248
test/libraries/PMA_StringNativeType_test.php
Normal file
248
test/libraries/PMA_StringNativeType_test.php
Normal file
@ -0,0 +1,248 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* Tests for Specialized String Class (Native) for phpMyAdmin
|
||||
*
|
||||
* @package PhpMyAdmin-test
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include to test.
|
||||
*/
|
||||
require_once 'libraries/StringNativeType.class.php';
|
||||
|
||||
/**
|
||||
* Tests for Specialized String Class (Native) for phpMyAdmin
|
||||
*
|
||||
* @package PhpMyAdmin-test
|
||||
*/
|
||||
class PMA_StringNativeType_Test extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* Test for PMA_StringNativeType::isAlnum
|
||||
*
|
||||
* @param integer $expected Expected output
|
||||
* @param string $str String to check
|
||||
*
|
||||
* @return void
|
||||
* @test
|
||||
* @dataProvider isAlnumData
|
||||
*/
|
||||
public function testIsAlnum($expected, $str)
|
||||
{
|
||||
$this->assertEquals(
|
||||
$expected,
|
||||
PMA_StringNativeType::isAlnum($str)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Data provider for testIsAlnum
|
||||
*
|
||||
* @return array Test data
|
||||
*/
|
||||
public function isAlnumData()
|
||||
{
|
||||
return array(
|
||||
array(true, "A"),
|
||||
array(false, "."),
|
||||
array(true, "a"),
|
||||
array(true, "2")
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for PMA_StringNativeType::isAlpha
|
||||
*
|
||||
* @param integer $expected Expected output
|
||||
* @param string $str String to check
|
||||
*
|
||||
* @return void
|
||||
* @test
|
||||
* @dataProvider isAlphaData
|
||||
*/
|
||||
public function testIsAlpha($expected, $str)
|
||||
{
|
||||
$this->assertEquals(
|
||||
$expected,
|
||||
PMA_StringNativeType::isAlpha($str)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Data provider for testIsAlpha
|
||||
*
|
||||
* @return array Test data
|
||||
*/
|
||||
public function isAlphaData()
|
||||
{
|
||||
return array(
|
||||
array(true, "k"),
|
||||
array(false, "1"),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for PMA_StringNativeType::isDigit
|
||||
*
|
||||
* @param integer $expected Expected output
|
||||
* @param string $str String to check
|
||||
*
|
||||
* @return void
|
||||
* @test
|
||||
* @dataProvider isDigitData
|
||||
*/
|
||||
public function testIsDigit($expected, $str)
|
||||
{
|
||||
$this->assertEquals(
|
||||
$expected,
|
||||
PMA_StringNativeType::isDigit($str)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Data provider for testIsDigit
|
||||
*
|
||||
* @return array Test data
|
||||
*/
|
||||
public function isDigitData()
|
||||
{
|
||||
return array(
|
||||
array(false, "k"),
|
||||
array(false, "?"),
|
||||
array(true, "1"),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for PMA_StringNativeType::isUpper
|
||||
*
|
||||
* @param integer $expected Expected output
|
||||
* @param string $str String to check
|
||||
*
|
||||
* @return void
|
||||
* @test
|
||||
* @dataProvider isUpperData
|
||||
*/
|
||||
public function testIsUpper($expected, $str)
|
||||
{
|
||||
$this->assertEquals(
|
||||
$expected,
|
||||
PMA_StringNativeType::isUpper($str)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Data provider for testIsUpper
|
||||
*
|
||||
* @return array Test data
|
||||
*/
|
||||
public function isUpperData()
|
||||
{
|
||||
return array(
|
||||
array(true, "A"),
|
||||
array(false, "b"),
|
||||
array(false, "1")
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for PMA_StringNativeType::isLower
|
||||
*
|
||||
* @param integer $expected Expected output
|
||||
* @param string $str String to check
|
||||
*
|
||||
* @return void
|
||||
* @test
|
||||
* @dataProvider isLowerData
|
||||
*/
|
||||
public function testIsLower($expected, $str)
|
||||
{
|
||||
$this->assertEquals(
|
||||
$expected,
|
||||
PMA_StringNativeType::isLower($str)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Data provider for testIsLower
|
||||
*
|
||||
* @return array Test data
|
||||
*/
|
||||
public function isLowerData()
|
||||
{
|
||||
return array(
|
||||
array(true, "a"),
|
||||
array(false, "B"),
|
||||
array(false, "1")
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for PMA_StringNativeType::isSpace
|
||||
*
|
||||
* @param integer $expected Expected output
|
||||
* @param string $str String to check
|
||||
*
|
||||
* @return void
|
||||
* @test
|
||||
* @dataProvider isSpaceData
|
||||
*/
|
||||
public function testIsSpace($expected, $str)
|
||||
{
|
||||
$this->assertEquals(
|
||||
$expected,
|
||||
PMA_StringNativeType::isSpace($str)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Data provider for testIsSpace
|
||||
*
|
||||
* @return array Test data
|
||||
*/
|
||||
public function isSpaceData()
|
||||
{
|
||||
return array(
|
||||
array(true, " "),
|
||||
array(false, '\n'),
|
||||
array(true, "\n"),
|
||||
array(false, "t"),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for PMA_StringNativeType::isHexDigit
|
||||
*
|
||||
* @param integer $expected Expected output
|
||||
* @param string $str String to check
|
||||
*
|
||||
* @return void
|
||||
* @test
|
||||
* @dataProvider isHexDigitData
|
||||
*/
|
||||
public function testIsHexDigit($expected, $str)
|
||||
{
|
||||
$this->assertEquals(
|
||||
$expected,
|
||||
PMA_StringNativeType::isHexDigit($str)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Data provider for testIsHexDigit
|
||||
*
|
||||
* @return array Test data
|
||||
*/
|
||||
public function isHexDigitData()
|
||||
{
|
||||
return array(
|
||||
array(true, "A"),
|
||||
array(false, "R"),
|
||||
array(true, "a")
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
@ -18,7 +18,19 @@ require_once 'libraries/StringNative.class.php';
|
||||
*/
|
||||
class PMA_StringNative_Test extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected $testClass;
|
||||
|
||||
/**
|
||||
* Setup function for test cases
|
||||
*
|
||||
* @access protected
|
||||
* @return void
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
$this->testClass = new PMA_StringNative;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for PMA_StringNative::strlen
|
||||
*
|
||||
@ -27,13 +39,13 @@ class PMA_StringNative_Test extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return void
|
||||
* @test
|
||||
* @dataProvider nativeStrlenData
|
||||
* @dataProvider strlenData
|
||||
*/
|
||||
public function testNativeStrlen($length, $str)
|
||||
{
|
||||
$this->assertEquals(
|
||||
$length,
|
||||
PMA_StringNative::strlen($str)
|
||||
$this->testClass->strlen($str)
|
||||
);
|
||||
}
|
||||
|
||||
@ -42,7 +54,7 @@ class PMA_StringNative_Test extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return array Test data
|
||||
*/
|
||||
public function nativeStrlenData()
|
||||
public function strlenData()
|
||||
{
|
||||
return array(
|
||||
array(2, "ab"),
|
||||
@ -61,13 +73,13 @@ class PMA_StringNative_Test extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return void
|
||||
* @test
|
||||
* @dataProvider nativeSubStrData
|
||||
* @dataProvider subStrData
|
||||
*/
|
||||
public function testNativeSubStr($str, $haystack, $start, $length)
|
||||
{
|
||||
$this->assertEquals(
|
||||
$str,
|
||||
PMA_StringNative::substr($haystack, $start, $length)
|
||||
$this->testClass->substr($haystack, $start, $length)
|
||||
);
|
||||
}
|
||||
|
||||
@ -76,7 +88,7 @@ class PMA_StringNative_Test extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return array Test data
|
||||
*/
|
||||
public function nativeSubStrData()
|
||||
public function subStrData()
|
||||
{
|
||||
return array(
|
||||
array("b", "ab", 1, 1),
|
||||
@ -94,13 +106,13 @@ class PMA_StringNative_Test extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return void
|
||||
* @test
|
||||
* @dataProvider nativeStrposData
|
||||
* @dataProvider strposData
|
||||
*/
|
||||
public function testNativeStrpos($pos, $haystack, $needle, $offset)
|
||||
{
|
||||
$this->assertEquals(
|
||||
$pos,
|
||||
PMA_StringNative::strpos($haystack, $needle, $offset)
|
||||
$this->testClass->strpos($haystack, $needle, $offset)
|
||||
);
|
||||
}
|
||||
|
||||
@ -125,13 +137,13 @@ class PMA_StringNative_Test extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return void
|
||||
* @test
|
||||
* @dataProvider nativeStrToLowerData
|
||||
* @dataProvider strToLowerData
|
||||
*/
|
||||
public function testNativeStrToLower($expected, $string)
|
||||
{
|
||||
$this->assertEquals(
|
||||
$expected,
|
||||
PMA_StringNative::strtolower($string)
|
||||
$this->testClass->strtolower($string)
|
||||
);
|
||||
}
|
||||
|
||||
@ -140,11 +152,11 @@ class PMA_StringNative_Test extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return array Test data
|
||||
*/
|
||||
public function nativeStrToLowerData()
|
||||
public function strToLowerData()
|
||||
{
|
||||
return array(
|
||||
array("mary had a", "Mary Had A", "UTF-8"),
|
||||
array("test string", "TEST STRING", "UTF-8")
|
||||
array("mary had a", "Mary Had A"),
|
||||
array("test string", "TEST STRING")
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user