Project

General

Profile

Bug #23117 » t3lib_divTest.php_15029_2.patch

Administrator Admin, 2010-07-07 16:12

View differences:

tests/t3lib/t3lib_divTest.php (working copy)
rmdir($directory);
}
/**
* Data provider for checkIsFirstPartOfStrReturnsTrueForMatchingFirstParts
*
* @return array
*/
public function matchingFirstPartsDataProvider() {
return array(
'hello world/hello' => array('hello world', 'hello'),
'hello/hello' => array('hello', 'hello'),
'null/zero' => array(NULL, 0),
'empty string/zero' => array('', 0),
);
}
/**
* Data provider for checkIsFirstPartOfStrReturnsFalseForNotMatchingFirstParts
*
* @return array
*/
public function notMatchingFirstPartsDataProvider() {
return array(
'hello/bye' => array('hello', 'bye'),
'bye/hello' => array('bye', 'hello'),
'string/array' => array('string', array()),
'array/string' => array(array(), 'string'),
'string/null' => array('string', NULL),
'null/string' => array(NULL, 'string'),
'array/null' => array(array(), NULL),
'null/array' => array(NULL, array()),
'empty strings' => array('', ''),
'empty string/null' => array('', NULL),
'empty string/false' => array('', FALSE),
'null/empty string' => array(NULL, ''),
'false/empty string' => array(FALSE, ''),
'zero/empty string' => array(0, '')
);
}
/**
* Checks if t3lib_div::isFirstPartOfStr returns true for a set of matching
* string/firstParts.
*
* @test
* @see t3lib_div::isFirstPartOfStr
* @dataProvider matchingFirstPartsDataProvider
*/
public function checkIsFirstPartOfStrReturnsTrueForMatchingFirstParts($str, $partStr) {
$this->assertTrue(t3lib_div::isFirstPartOfStr($str, $partStr));
}
/**
* Checks if t3lib_div::isFirstPartOfStr returns false for a not matching
* pair of string and firstPart.
*
* @test
* @see t3lib_div::isFirstPartOfStr
* @dataProvider notMatchingFirstPartsDataProvider
*/
public function checkIsFirstPartOfStrReturnsFalseForNotMatchingFirstParts($str, $partStr) {
$this->assertFalse(t3lib_div::isFirstPartOfStr($str, $partStr));
}
/**
* Checks if t3lib_div::isFirstPartOfStr works case sensitive.
*
* @test
* @see t3lib_div::isFirstPartOfStr
*/
public function checkIsFirstPartOfStrWorksCaseSensitive($str, $partStr) {
$this->assertFalse(t3lib_div::isFirstPartOfStr('hello world', 'Hello'));
}
}
?>
(2-2/4)