phpmyadmin/test/libraries/stringMb_test.php
Hugues Peccatte 8463a44bb0 Create new PMA mb_* functions and initialise unit tests.
Signed-off-by: Hugues Peccatte <hugues.peccatte@gmail.com>
2014-09-28 14:08:04 +02:00

104 lines
2.3 KiB
PHP

<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* tests for multibytes string library
*
* @package PhpMyAdmin-test
*/
require_once 'test/libraries/string_test_abstract.php';
/**
* tests for multibytes string library
*
* @package PhpMyAdmin-test
*/
class PMA_StringMbTest extends PMA_StringTest
{
/**
* Setup function for test cases
*
* @access protected
* @return void
*/
protected function setUp()
{
if (!@function_exists('mb_strlen')) {
$this->markTestSkipped(
"Multibyte functions don't exist, skipping test."
);
}
require_once 'libraries/stringMb.lib.php';
}
/**
* Data provider for testStrlen
*
* @return array Test data
*/
public function providerStrlen()
{
return array_merge(
parent::providerStrlen(),
array(array(13, "chaîne testée"))
);
}
/**
* Data provider for testSubStr
*
* @return array Test data
*/
public function providerSubstr()
{
return array_merge(
parent::providerSubstr(),
array(
array("rçon", "garçon", 2, 4),
array("de ", "garçon de café", 7, 3)
)
);
}
/**
* Data provider for testSubstrCount
*
* @return array Test data
*/
public function providerSubstrCount()
{
return array_merge(
parent::providerSubstrCount(),
array(
array(2, "garçon de café", "a"),
array(1, "garçon de café attristé", "ç"),
array(2, "garçon de café attristé", "é"),
array(1, "garçon de café attristé", ""),
)
);
}
//providerSubstrCountException
/**
* Data provider for testStrpos
*
* @return array Test data
*/
public function providerStrpos()
{
return array_merge(
parent::providerStrpos(),
array(
array(16, "garçon de café attristé", "t"),
array(13, "garçon de café attristé", "é"),
array(22, "garçon de café attristé", "é", 15),
)
);
}
//providerStrpos
//providerStrrchr
//providerStrtolower
}