1
0
mirror of https://github.com/danielstjules/Stringy.git synced 2025-08-12 16:24:00 +02:00

Cleanup tests a bit

Getting over my irrational fear of multi-line return statements
This commit is contained in:
Daniel St. Jules
2013-09-27 20:08:47 -04:00
parent fa36291254
commit f6085ed2cb
3 changed files with 219 additions and 327 deletions

View File

@@ -2,35 +2,31 @@
abstract class CommonTest extends PHPUnit_Framework_TestCase abstract class CommonTest extends PHPUnit_Framework_TestCase
{ {
public function stringsForUpperCaseFirst() public function upperCaseFirstProvider()
{ {
$testData = array( return array(
array('Test', 'Test'), array('Test', 'Test'),
array('Test', 'test'), array('Test', 'test'),
array('1a', '1a'), array('1a', '1a'),
array('Σ test', 'σ test', 'UTF-8'), array('Σ test', 'σ test', 'UTF-8'),
array(' σ test', ' σ test', 'UTF-8') array(' σ test', ' σ test', 'UTF-8')
); );
return $testData;
} }
public function stringsForLowerCaseFirst() public function lowerCaseFirstProvider()
{ {
$testData = array( return array(
array('test', 'Test'), array('test', 'Test'),
array('test', 'test'), array('test', 'test'),
array('1a', '1a'), array('1a', '1a'),
array('σ test', 'Σ test', 'UTF-8'), array('σ test', 'Σ test', 'UTF-8'),
array(' Σ test', ' Σ test', 'UTF-8') array(' Σ test', ' Σ test', 'UTF-8')
); );
return $testData;
} }
public function stringsForCamelize() public function camelizeProvider()
{ {
$testData = array( return array(
array('camelCase', 'CamelCase'), array('camelCase', 'CamelCase'),
array('camelCase', 'Camel-Case'), array('camelCase', 'Camel-Case'),
array('camelCase', 'camel case'), array('camelCase', 'camel case'),
@@ -45,13 +41,11 @@ abstract class CommonTest extends PHPUnit_Framework_TestCase
array('στανιλCase', 'Στανιλ case', 'UTF-8'), array('στανιλCase', 'Στανιλ case', 'UTF-8'),
array('σamelCase', 'σamel Case', 'UTF-8') array('σamelCase', 'σamel Case', 'UTF-8')
); );
return $testData;
} }
public function stringsForUpperCamelize() public function upperCamelizeProvider()
{ {
$testData = array( return array(
array('CamelCase', 'camelCase'), array('CamelCase', 'camelCase'),
array('CamelCase', 'Camel-Case'), array('CamelCase', 'Camel-Case'),
array('CamelCase', 'camel case'), array('CamelCase', 'camel case'),
@@ -66,13 +60,11 @@ abstract class CommonTest extends PHPUnit_Framework_TestCase
array('ΣτανιλCase', 'στανιλ case', 'UTF-8'), array('ΣτανιλCase', 'στανιλ case', 'UTF-8'),
array('ΣamelCase', 'Σamel Case', 'UTF-8') array('ΣamelCase', 'Σamel Case', 'UTF-8')
); );
return $testData;
} }
public function stringsForDasherize() public function dasherizeProvider()
{ {
$testData = array( return array(
array('test-case', 'testCase'), array('test-case', 'testCase'),
array('test-case', 'Test-Case'), array('test-case', 'Test-Case'),
array('test-case', 'test case'), array('test-case', 'test case'),
@@ -89,13 +81,11 @@ abstract class CommonTest extends PHPUnit_Framework_TestCase
array('στανιλ-case', 'Στανιλ case', 'UTF-8'), array('στανιλ-case', 'Στανιλ case', 'UTF-8'),
array('σash-case', 'Σash Case', 'UTF-8') array('σash-case', 'Σash Case', 'UTF-8')
); );
return $testData;
} }
public function stringsForUnderscored() public function underscoredProvider()
{ {
$testData = array( return array(
array('test_case', 'testCase'), array('test_case', 'testCase'),
array('test_case', 'Test-Case'), array('test_case', 'Test-Case'),
array('test_case', 'test case'), array('test_case', 'test case'),
@@ -112,63 +102,53 @@ abstract class CommonTest extends PHPUnit_Framework_TestCase
array('στανιλ_case', 'Στανιλ case', 'UTF-8'), array('στανιλ_case', 'Στανιλ case', 'UTF-8'),
array('σash_case', 'Σash Case', 'UTF-8') array('σash_case', 'Σash Case', 'UTF-8')
); );
return $testData;
} }
public function stringsForSwapCase() public function swapCaseProvider()
{ {
$testData = array( return array(
array('TESTcASE', 'testCase'), array('TESTcASE', 'testCase'),
array('tEST-cASE', 'Test-Case'), array('tEST-cASE', 'Test-Case'),
array(' - σASH cASE', ' - Σash Case', 'UTF-8'), array(' - σASH cASE', ' - Σash Case', 'UTF-8'),
array('νΤΑΝΙΛ', 'Ντανιλ', 'UTF-8') array('νΤΑΝΙΛ', 'Ντανιλ', 'UTF-8')
); );
return $testData;
} }
public function stringsForTitleize() public function titleizeProvider()
{ {
$ignore = array('at', 'by', 'for', 'in', 'of', 'on', 'out', 'to', 'the'); $ignore = array('at', 'by', 'for', 'in', 'of', 'on', 'out', 'to', 'the');
$testData = array( return array(
array('Testing The Method', 'testing the method'), array('Testing The Method', 'testing the method'),
array('Testing the Method', 'testing the method', $ignore, 'UTF-8'), array('Testing the Method', 'testing the method', $ignore, 'UTF-8'),
array('I Like to Watch DVDs at Home', 'i like to watch DVDs at home', array('I Like to Watch DVDs at Home', 'i like to watch DVDs at home',
$ignore, 'UTF-8'), $ignore, 'UTF-8'),
array('Θα Ήθελα Να Φύγει', ' Θα ήθελα να φύγει ', null, 'UTF-8') array('Θα Ήθελα Να Φύγει', ' Θα ήθελα να φύγει ', null, 'UTF-8')
); );
return $testData;
} }
public function stringsForHumanize() public function humanizeProvider()
{ {
$testData = array( return array(
array('Author', 'author_id'), array('Author', 'author_id'),
array('Test user', ' _test_user_'), array('Test user', ' _test_user_'),
array('Συγγραφέας', ' συγγραφέας_id ', 'UTF-8') array('Συγγραφέας', ' συγγραφέας_id ', 'UTF-8')
); );
return $testData;
} }
public function stringsForTidy() public function tidyProvider()
{ {
$testData = array( return array(
array('"I see..."', '“I see…”'), array('"I see..."', '“I see…”'),
array("'This too'", "This too"), array("'This too'", "This too"),
array('test-dash', 'test—dash'), array('test-dash', 'test—dash'),
array('Ο συγγραφέας είπε...', 'Ο συγγραφέας είπε…') array('Ο συγγραφέας είπε...', 'Ο συγγραφέας είπε…')
); );
return $testData;
} }
public function stringsForCollapseWhitespace() public function collapseWhitespaceProvider()
{ {
$testData = array( return array(
array('foo bar', ' foo bar '), array('foo bar', ' foo bar '),
array('test string', 'test string'), array('test string', 'test string'),
array('Ο συγγραφέας', ' Ο συγγραφέας '), array('Ο συγγραφέας', ' Ο συγγραφέας '),
@@ -178,13 +158,11 @@ abstract class CommonTest extends PHPUnit_Framework_TestCase
array('', ' '), array('', ' '),
array('', ''), array('', ''),
); );
return $testData;
} }
public function stringsForToAscii() public function toAsciiProvider()
{ {
$testData = array( return array(
array('foo bar', 'fòô bàř'), array('foo bar', 'fòô bàř'),
array(' TEST ', ' ŤÉŚŢ '), array(' TEST ', ' ŤÉŚŢ '),
array('φ = z = 3', 'φ = ź = 3'), array('φ = z = 3', 'φ = ź = 3'),
@@ -192,13 +170,11 @@ abstract class CommonTest extends PHPUnit_Framework_TestCase
array('lysaya gora', 'лысая гора'), array('lysaya gora', 'лысая гора'),
array('shchuka', 'щука') array('shchuka', 'щука')
); );
return $testData;
} }
public function stringsForPad() public function padProvider()
{ {
$testData = array( return array(
// $length <= $str // $length <= $str
array('foo bar', 'foo bar', -1), array('foo bar', 'foo bar', -1),
array('foo bar', 'foo bar', 7), array('foo bar', 'foo bar', 7),
@@ -235,47 +211,39 @@ abstract class CommonTest extends PHPUnit_Framework_TestCase
array('¬øfòô bàř¬ø', 'fòô bàř', 11, '¬øÿ', 'both', 'UTF-8'), array('¬øfòô bàř¬ø', 'fòô bàř', 11, '¬øÿ', 'both', 'UTF-8'),
array('¬øfòô bàř¬øÿ', 'fòô bàř', 12, '¬øÿ', 'both', 'UTF-8') array('¬øfòô bàř¬øÿ', 'fòô bàř', 12, '¬øÿ', 'both', 'UTF-8')
); );
return $testData;
} }
public function stringsForPadLeft() public function padLeftProvider()
{ {
$testData = array( return array(
array(' foo bar', 'foo bar', 9), array(' foo bar', 'foo bar', 9),
array('_*_foo bar', 'foo bar', 10, '_*'), array('_*_foo bar', 'foo bar', 10, '_*'),
array('¬ø¬øfòô bàř', 'fòô bàř', 11, '¬ø', 'UTF-8'), array('¬ø¬øfòô bàř', 'fòô bàř', 11, '¬ø', 'UTF-8'),
); );
return $testData;
} }
public function stringsForPadRight() public function padRightProvider()
{ {
$testData = array( return array(
array('foo bar ', 'foo bar', 9), array('foo bar ', 'foo bar', 9),
array('foo bar_*_', 'foo bar', 10, '_*'), array('foo bar_*_', 'foo bar', 10, '_*'),
array('fòô bàř¬ø¬ø', 'fòô bàř', 11, '¬ø', 'UTF-8'), array('fòô bàř¬ø¬ø', 'fòô bàř', 11, '¬ø', 'UTF-8'),
); );
return $testData;
} }
public function stringsForPadBoth() public function padBothProvider()
{ {
$testData = array( return array(
array('foo bar ', 'foo bar', 8), array('foo bar ', 'foo bar', 8),
array(' foo bar ', 'foo bar', 9, ' '), array(' foo bar ', 'foo bar', 9, ' '),
array('¬fòô bàř¬ø', 'fòô bàř', 10, '¬øÿ', 'UTF-8'), array('¬fòô bàř¬ø', 'fòô bàř', 10, '¬øÿ', 'UTF-8'),
array('¬øfòô bàř¬øÿ', 'fòô bàř', 12, '¬øÿ', 'UTF-8') array('¬øfòô bàř¬øÿ', 'fòô bàř', 12, '¬øÿ', 'UTF-8')
); );
return $testData;
} }
public function stringsForStartsWith() public function startsWithProvider()
{ {
$testData = array( return array(
array(true, 'foo bars', 'foo bar'), array(true, 'foo bars', 'foo bar'),
array(true, 'FOO bars', 'foo bar', false), array(true, 'FOO bars', 'foo bar', false),
array(true, 'FOO bars', 'foo BAR', false), array(true, 'FOO bars', 'foo BAR', false),
@@ -288,13 +256,11 @@ abstract class CommonTest extends PHPUnit_Framework_TestCase
array(false, 'FÒÔ bàřs', 'fòô bàř', true, 'UTF-8'), array(false, 'FÒÔ bàřs', 'fòô bàř', true, 'UTF-8'),
array(false, 'fòô bàřs', 'fòô BÀŘ', true, 'UTF-8'), array(false, 'fòô bàřs', 'fòô BÀŘ', true, 'UTF-8'),
); );
return $testData;
} }
public function stringsForEndsWith() public function endsWithProvider()
{ {
$testData = array( return array(
array(true, 'foo bars', 'o bars'), array(true, 'foo bars', 'o bars'),
array(true, 'FOO bars', 'o bars', false), array(true, 'FOO bars', 'o bars', false),
array(true, 'FOO bars', 'o BARs', false), array(true, 'FOO bars', 'o BARs', false),
@@ -307,13 +273,11 @@ abstract class CommonTest extends PHPUnit_Framework_TestCase
array(false, 'FÒÔ bàřs', 'fòô bàřs', true, 'UTF-8'), array(false, 'FÒÔ bàřs', 'fòô bàřs', true, 'UTF-8'),
array(false, 'fòô bàřs', 'fòô BÀŘS', true, 'UTF-8'), array(false, 'fòô bàřs', 'fòô BÀŘS', true, 'UTF-8'),
); );
return $testData;
} }
public function stringsForToSpaces() public function toSpacesProvider()
{ {
$testData = array( return array(
array(' foo bar ', ' foo bar '), array(' foo bar ', ' foo bar '),
array(' foo bar ', ' foo bar ', 5), array(' foo bar ', ' foo bar ', 5),
array(' foo bar ', ' foo bar ', 2), array(' foo bar ', ' foo bar ', 2),
@@ -321,52 +285,44 @@ abstract class CommonTest extends PHPUnit_Framework_TestCase
array(" foo\n bar", " foo\n bar"), array(" foo\n bar", " foo\n bar"),
array(" fòô\n bàř", " fòô\n bàř") array(" fòô\n bàř", " fòô\n bàř")
); );
return $testData;
} }
public function stringsForToTabs() public function toTabsProvider()
{ {
$testData = array( return array(
array(' foo bar ', ' foo bar '), array(' foo bar ', ' foo bar '),
array(' foo bar ', ' foo bar ', 5), array(' foo bar ', ' foo bar ', 5),
array(' foo bar ', ' foo bar ', 2), array(' foo bar ', ' foo bar ', 2),
array(" foo\n bar", " foo\n bar"), array(" foo\n bar", " foo\n bar"),
array(" fòô\n bàř", " fòô\n bàř") array(" fòô\n bàř", " fòô\n bàř")
); );
return $testData;
} }
public function stringsForToLowerCase() public function toLowerCaseProvider()
{ {
$testData = array( return array(
array('foo bar', 'FOO BAR'), array('foo bar', 'FOO BAR'),
array(' foo_bar ', ' FOO_bar '), array(' foo_bar ', ' FOO_bar '),
array('fòô bàř', 'FÒÔ BÀŘ', 'UTF-8'), array('fòô bàř', 'FÒÔ BÀŘ', 'UTF-8'),
array(' fòô_bàř ', ' FÒÔ_bàř ', 'UTF-8'), array(' fòô_bàř ', ' FÒÔ_bàř ', 'UTF-8'),
array('αυτοκίνητο', 'ΑΥΤΟΚΊΝΗΤΟ', 'UTF-8'), array('αυτοκίνητο', 'ΑΥΤΟΚΊΝΗΤΟ', 'UTF-8'),
); );
return $testData;
} }
public function stringsForToUpperCase() public function toUpperCaseProvider()
{ {
$testData = array( return array(
array('FOO BAR', 'foo bar'), array('FOO BAR', 'foo bar'),
array(' FOO_BAR ', ' FOO_bar '), array(' FOO_BAR ', ' FOO_bar '),
array('FÒÔ BÀŘ', 'fòô bàř', 'UTF-8'), array('FÒÔ BÀŘ', 'fòô bàř', 'UTF-8'),
array(' FÒÔ_BÀŘ ', ' FÒÔ_bàř ', 'UTF-8'), array(' FÒÔ_BÀŘ ', ' FÒÔ_bàř ', 'UTF-8'),
array('ΑΥΤΟΚΊΝΗΤΟ', 'αυτοκίνητο', 'UTF-8'), array('ΑΥΤΟΚΊΝΗΤΟ', 'αυτοκίνητο', 'UTF-8'),
); );
return $testData;
} }
public function stringsForSlugify() public function slugifyProvider()
{ {
$testData = array( return array(
array('foo-bar', ' foo bar '), array('foo-bar', ' foo bar '),
array('foo-dbar', " Foo d'Bar "), array('foo-dbar', " Foo d'Bar "),
array('a-string-with-dashes', 'A string-with-dashes'), array('a-string-with-dashes', 'A string-with-dashes'),
@@ -376,13 +332,11 @@ abstract class CommonTest extends PHPUnit_Framework_TestCase
array('perevirka-ryadka', 'перевірка рядка'), array('perevirka-ryadka', 'перевірка рядка'),
array('bukvar-s-bukvoy-y', 'букварь с буквой ы') array('bukvar-s-bukvoy-y', 'букварь с буквой ы')
); );
return $testData;
} }
public function stringsForContains() public function containsProvider()
{ {
$testData = array( return array(
array(true, 'This string contains foo bar', 'foo bar'), array(true, 'This string contains foo bar', 'foo bar'),
array(true, '12398!@(*%!@# @!%#*&^%', ' @!%#*&^%'), array(true, '12398!@(*%!@# @!%#*&^%', ' @!%#*&^%'),
array(true, 'Ο συγγραφέας είπε', 'συγγραφέας', 'UTF-8'), array(true, 'Ο συγγραφέας είπε', 'συγγραφέας', 'UTF-8'),
@@ -405,26 +359,22 @@ abstract class CommonTest extends PHPUnit_Framework_TestCase
array(false, 'Ο συγγραφέας είπε', ' συγγραφέας ', false, 'UTF-8'), array(false, 'Ο συγγραφέας είπε', ' συγγραφέας ', false, 'UTF-8'),
array(false, 'å´¥©¨ˆßå˚ ∆∂˙©å∑¥øœ¬', ' ßÅ˚', false, 'UTF-8') array(false, 'å´¥©¨ˆßå˚ ∆∂˙©å∑¥øœ¬', ' ßÅ˚', false, 'UTF-8')
); );
return $testData;
} }
public function stringsForSurround() public function surroundProvider()
{ {
$testData = array( return array(
array('__foobar__', 'foobar', '__'), array('__foobar__', 'foobar', '__'),
array('test', 'test', ''), array('test', 'test', ''),
array('**', '', '*'), array('**', '', '*'),
array('¬fòô bàř¬', 'fòô bàř', '¬'), array('¬fòô bàř¬', 'fòô bàř', '¬'),
array('ßå∆˚ test ßå∆˚', ' test ', 'ßå∆˚') array('ßå∆˚ test ßå∆˚', ' test ', 'ßå∆˚')
); );
return $testData;
} }
public function stringsForInsert() public function insertProvider()
{ {
$testData = array( return array(
array('foo bar', 'oo bar', 'f', 0), array('foo bar', 'oo bar', 'f', 0),
array('foo bar', 'f bar', 'oo', 1), array('foo bar', 'f bar', 'oo', 1),
array('f bar', 'f bar', 'oo', 20), array('f bar', 'f bar', 'oo', 20),
@@ -433,13 +383,11 @@ abstract class CommonTest extends PHPUnit_Framework_TestCase
array('fòô bàř', 'f bàř', 'òô', 1, 'UTF-8'), array('fòô bàř', 'f bàř', 'òô', 1, 'UTF-8'),
array('fòô bàř', 'fòô bà', 'ř', 6, 'UTF-8') array('fòô bàř', 'fòô bà', 'ř', 6, 'UTF-8')
); );
return $testData;
} }
public function stringsForTruncate() public function truncateProvider()
{ {
$testData = array( return array(
array('Test foo bar', 'Test foo bar', 12), array('Test foo bar', 'Test foo bar', 12),
array('Test foo ba', 'Test foo bar', 11), array('Test foo ba', 'Test foo bar', 11),
array('Test foo', 'Test foo bar', 8), array('Test foo', 'Test foo bar', 8),
@@ -463,13 +411,11 @@ abstract class CommonTest extends PHPUnit_Framework_TestCase
array('Teϰϰ', 'Test fòô bàř', 4, 'ϰϰ', 'UTF-8'), array('Teϰϰ', 'Test fòô bàř', 4, 'ϰϰ', 'UTF-8'),
array('What are your pl...', 'What are your plans today?', 19, '...') array('What are your pl...', 'What are your plans today?', 19, '...')
); );
return $testData;
} }
public function stringsForSafeTruncate() public function safeTruncateProvider()
{ {
$testData = array( return array(
array('Test foo bar', 'Test foo bar', 12), array('Test foo bar', 'Test foo bar', 12),
array('Test foo', 'Test foo bar', 11), array('Test foo', 'Test foo bar', 11),
array('Test foo', 'Test foo bar', 8), array('Test foo', 'Test foo bar', 8),
@@ -493,37 +439,31 @@ abstract class CommonTest extends PHPUnit_Framework_TestCase
array('ϰϰ', 'Test fòô bàř', 4, 'ϰϰ', 'UTF-8'), array('ϰϰ', 'Test fòô bàř', 4, 'ϰϰ', 'UTF-8'),
array('What are your plans...', 'What are your plans today?', 22, '...') array('What are your plans...', 'What are your plans today?', 22, '...')
); );
return $testData;
} }
public function stringsForReverse() public function reverseProvider()
{ {
$testData = array( return array(
array('', ''), array('', ''),
array('raboof', 'foobar'), array('raboof', 'foobar'),
array('řàbôòf', 'fòôbàř', 'UTF-8'), array('řàbôòf', 'fòôbàř', 'UTF-8'),
array('řàb ôòf', 'fòô bàř', 'UTF-8'), array('řàb ôòf', 'fòô bàř', 'UTF-8'),
array('∂∆ ˚åß', 'ßå˚ ∆∂', 'UTF-8') array('∂∆ ˚åß', 'ßå˚ ∆∂', 'UTF-8')
); );
return $testData;
} }
public function stringsForShuffle() public function shuffleProvider()
{ {
$testData = array( return array(
array('foo bar'), array('foo bar'),
array('∂∆ ˚åß', 'UTF-8'), array('∂∆ ˚åß', 'UTF-8'),
array('å´¥©¨ˆßå˚ ∆∂˙©å∑¥øœ¬', 'UTF-8') array('å´¥©¨ˆßå˚ ∆∂˙©å∑¥øœ¬', 'UTF-8')
); );
return $testData;
} }
public function stringsForTrim() public function trimProvider()
{ {
$testData = array( return array(
array('foo bar', ' foo bar '), array('foo bar', ' foo bar '),
array('foo bar', ' foo bar'), array('foo bar', ' foo bar'),
array('foo bar', 'foo bar '), array('foo bar', 'foo bar '),
@@ -533,13 +473,11 @@ abstract class CommonTest extends PHPUnit_Framework_TestCase
array('fòô bàř', 'fòô bàř '), array('fòô bàř', 'fòô bàř '),
array('fòô bàř', "\n\t fòô bàř \n\t") array('fòô bàř', "\n\t fòô bàř \n\t")
); );
return $testData;
} }
public function stringsForLongestCommonPrefix() public function longestCommonPrefixProvider()
{ {
$testData = array( return array(
array('foo', 'foobar', 'foo bar'), array('foo', 'foobar', 'foo bar'),
array('foo bar', 'foo bar', 'foo bar'), array('foo bar', 'foo bar', 'foo bar'),
array('f', 'foo bar', 'far boo'), array('f', 'foo bar', 'far boo'),
@@ -551,13 +489,11 @@ abstract class CommonTest extends PHPUnit_Framework_TestCase
array('', 'toy car', 'fòô bar', 'UTF-8'), array('', 'toy car', 'fòô bar', 'UTF-8'),
array('', 'fòô bar', '', 'UTF-8'), array('', 'fòô bar', '', 'UTF-8'),
); );
return $testData;
} }
public function stringsForLongestCommonSuffix() public function longestCommonSuffixProvider()
{ {
$testData = array( return array(
array('bar', 'foobar', 'foo bar'), array('bar', 'foobar', 'foo bar'),
array('foo bar', 'foo bar', 'foo bar'), array('foo bar', 'foo bar', 'foo bar'),
array('ar', 'foo bar', 'boo far'), array('ar', 'foo bar', 'boo far'),
@@ -569,13 +505,11 @@ abstract class CommonTest extends PHPUnit_Framework_TestCase
array('', 'toy car', 'fòô bàř', 'UTF-8'), array('', 'toy car', 'fòô bàř', 'UTF-8'),
array('', 'fòô bàř', '', 'UTF-8'), array('', 'fòô bàř', '', 'UTF-8'),
); );
return $testData;
} }
public function stringsForLongestCommonSubstring() public function longestCommonSubstringProvider()
{ {
$testData = array( return array(
array('foo', 'foobar', 'foo bar'), array('foo', 'foobar', 'foo bar'),
array('foo bar', 'foo bar', 'foo bar'), array('foo bar', 'foo bar', 'foo bar'),
array('oo ', 'foo bar', 'boo far'), array('oo ', 'foo bar', 'boo far'),
@@ -587,25 +521,21 @@ abstract class CommonTest extends PHPUnit_Framework_TestCase
array(' ', 'toy car', 'fòô bàř', 'UTF-8'), array(' ', 'toy car', 'fòô bàř', 'UTF-8'),
array('', 'fòô bàř', '', 'UTF-8'), array('', 'fòô bàř', '', 'UTF-8'),
); );
return $testData;
} }
public function stringsForLength() public function lengthProvider()
{ {
$testData = array( return array(
array(11, ' foo bar '), array(11, ' foo bar '),
array(1, 'f'), array(1, 'f'),
array(0, ''), array(0, ''),
array(7, 'fòô bàř', 'UTF-8') array(7, 'fòô bàř', 'UTF-8')
); );
return $testData;
} }
public function stringsForSubstr() public function substrProvider()
{ {
$testData = array( return array(
array('foo bar', 'foo bar', 0), array('foo bar', 'foo bar', 0),
array('bar', 'foo bar', 4), array('bar', 'foo bar', 4),
array('bar', 'foo bar', 4, null), array('bar', 'foo bar', 4, null),
@@ -616,13 +546,11 @@ abstract class CommonTest extends PHPUnit_Framework_TestCase
array('ô b', 'fòô bàř', 2, 3, 'UTF-8'), array('ô b', 'fòô bàř', 2, 3, 'UTF-8'),
array('', 'fòô bàř', 4, 0, 'UTF-8') array('', 'fòô bàř', 4, 0, 'UTF-8')
); );
return $testData;
} }
public function stringsForAt() public function atProvider()
{ {
$testData = array( return array(
array('f', 'foo bar', 0), array('f', 'foo bar', 0),
array('o', 'foo bar', 1), array('o', 'foo bar', 1),
array('r', 'foo bar', 6), array('r', 'foo bar', 6),
@@ -632,13 +560,11 @@ abstract class CommonTest extends PHPUnit_Framework_TestCase
array('ř', 'fòô bàř', 6, 'UTF-8'), array('ř', 'fòô bàř', 6, 'UTF-8'),
array('', 'fòô bàř', 7, 'UTF-8'), array('', 'fòô bàř', 7, 'UTF-8'),
); );
return $testData;
} }
public function stringsForFirst() public function firstProvider()
{ {
$testData = array( return array(
array('', 'foo bar', -5), array('', 'foo bar', -5),
array('', 'foo bar', 0), array('', 'foo bar', 0),
array('f', 'foo bar', 1), array('f', 'foo bar', 1),
@@ -652,13 +578,11 @@ abstract class CommonTest extends PHPUnit_Framework_TestCase
array('fòô bàř', 'fòô bàř', 7, 'UTF-8'), array('fòô bàř', 'fòô bàř', 7, 'UTF-8'),
array('fòô bàř', 'fòô bàř', 8, 'UTF-8'), array('fòô bàř', 'fòô bàř', 8, 'UTF-8'),
); );
return $testData;
} }
public function stringsForLast() public function lastProvider()
{ {
$testData = array( return array(
array('', 'foo bar', -5), array('', 'foo bar', -5),
array('', 'foo bar', 0), array('', 'foo bar', 0),
array('r', 'foo bar', 1), array('r', 'foo bar', 1),
@@ -672,13 +596,11 @@ abstract class CommonTest extends PHPUnit_Framework_TestCase
array('fòô bàř', 'fòô bàř', 7, 'UTF-8'), array('fòô bàř', 'fòô bàř', 7, 'UTF-8'),
array('fòô bàř', 'fòô bàř', 8, 'UTF-8'), array('fòô bàř', 'fòô bàř', 8, 'UTF-8'),
); );
return $testData;
} }
public function stringsForEnsureLeft() public function ensureLeftProvider()
{ {
$testData = array( return array(
array('foobar', 'foobar', 'f'), array('foobar', 'foobar', 'f'),
array('foobar', 'foobar', 'foo'), array('foobar', 'foobar', 'foo'),
array('foo/foobar', 'foobar', 'foo/'), array('foo/foobar', 'foobar', 'foo/'),
@@ -690,13 +612,11 @@ abstract class CommonTest extends PHPUnit_Framework_TestCase
array('http://fòôbàř', 'fòôbàř', 'http://', 'UTF-8'), array('http://fòôbàř', 'fòôbàř', 'http://', 'UTF-8'),
array('http://fòôbàř', 'http://fòôbàř', 'http://', 'UTF-8'), array('http://fòôbàř', 'http://fòôbàř', 'http://', 'UTF-8'),
); );
return $testData;
} }
public function stringsForEnsureRight() public function ensureRightProvider()
{ {
$testData = array( return array(
array('foobar', 'foobar', 'r'), array('foobar', 'foobar', 'r'),
array('foobar', 'foobar', 'bar'), array('foobar', 'foobar', 'bar'),
array('foobar/bar', 'foobar', '/bar'), array('foobar/bar', 'foobar', '/bar'),
@@ -708,13 +628,11 @@ abstract class CommonTest extends PHPUnit_Framework_TestCase
array('fòôbàř.com/', 'fòôbàř', '.com/', 'UTF-8'), array('fòôbàř.com/', 'fòôbàř', '.com/', 'UTF-8'),
array('fòôbàř.com/', 'fòôbàř.com/', '.com/', 'UTF-8'), array('fòôbàř.com/', 'fòôbàř.com/', '.com/', 'UTF-8'),
); );
return $testData;
} }
public function stringsForRemoveLeft() public function removeLeftProvider()
{ {
$testData = array( return array(
array('foo bar', 'foo bar', ''), array('foo bar', 'foo bar', ''),
array('oo bar', 'foo bar', 'f'), array('oo bar', 'foo bar', 'f'),
array('bar', 'foo bar', 'foo '), array('bar', 'foo bar', 'foo '),
@@ -726,13 +644,11 @@ abstract class CommonTest extends PHPUnit_Framework_TestCase
array('fòô bàř', 'fòô bàř', 'òô', 'UTF-8'), array('fòô bàř', 'fòô bàř', 'òô', 'UTF-8'),
array('fòô bàř', 'fòô bàř', 'òô bàř', 'UTF-8') array('fòô bàř', 'fòô bàř', 'òô bàř', 'UTF-8')
); );
return $testData;
} }
public function stringsForRemoveRight() public function removeRightProvider()
{ {
$testData = array( return array(
array('foo bar', 'foo bar', ''), array('foo bar', 'foo bar', ''),
array('foo ba', 'foo bar', 'r'), array('foo ba', 'foo bar', 'r'),
array('foo', 'foo bar', ' bar'), array('foo', 'foo bar', ' bar'),
@@ -744,13 +660,11 @@ abstract class CommonTest extends PHPUnit_Framework_TestCase
array('fòô bàř', 'fòô bàř', 'bà', 'UTF-8'), array('fòô bàř', 'fòô bàř', 'bà', 'UTF-8'),
array('fòô bàř', 'fòô bàř', 'fòô bà', 'UTF-8') array('fòô bàř', 'fòô bàř', 'fòô bà', 'UTF-8')
); );
return $testData;
} }
public function stringsForIsAlpha() public function isAlphaProvider()
{ {
$testData = array( return array(
array(true, ''), array(true, ''),
array(true, 'foobar'), array(true, 'foobar'),
array(false, 'foo bar'), array(false, 'foo bar'),
@@ -762,13 +676,11 @@ abstract class CommonTest extends PHPUnit_Framework_TestCase
array(false, 'ҠѨњ¨ˆфгШ', 'UTF-8'), array(false, 'ҠѨњ¨ˆфгШ', 'UTF-8'),
array(true, '丹尼爾', 'UTF-8') array(true, '丹尼爾', 'UTF-8')
); );
return $testData;
} }
public function stringsForIsAlphanumeric() public function isAlphanumericProvider()
{ {
$testData = array( return array(
array(true, ''), array(true, ''),
array(true, 'foobar1'), array(true, 'foobar1'),
array(false, 'foo bar'), array(false, 'foo bar'),
@@ -783,13 +695,11 @@ abstract class CommonTest extends PHPUnit_Framework_TestCase
array(true, انيال1', 'UTF-8'), array(true, انيال1', 'UTF-8'),
array(false, انيال1 ', 'UTF-8') array(false, انيال1 ', 'UTF-8')
); );
return $testData;
} }
public function stringsForIsBlank() public function isBlankProvider()
{ {
$testData = array( return array(
array(true, ''), array(true, ''),
array(true, ' '), array(true, ' '),
array(true, "\n\t "), array(true, "\n\t "),
@@ -803,13 +713,11 @@ abstract class CommonTest extends PHPUnit_Framework_TestCase
array(false, ' z', 'UTF-8'), array(false, ' z', 'UTF-8'),
array(false, ' 1', 'UTF-8'), array(false, ' 1', 'UTF-8'),
); );
return $testData;
} }
public function stringsForIsJson() public function isJsonProvider()
{ {
$testData = array( return array(
array(false, ''), array(false, ''),
array(false, '123'), array(false, '123'),
array(true, '{"foo": "bar"}'), array(true, '{"foo": "bar"}'),
@@ -825,13 +733,11 @@ abstract class CommonTest extends PHPUnit_Framework_TestCase
array(true, '["fòô"]', 'UTF-8'), array(true, '["fòô"]', 'UTF-8'),
array(false, '{"fòô": "bàř"]', 'UTF-8'), array(false, '{"fòô": "bàř"]', 'UTF-8'),
); );
return $testData;
} }
public function stringsForIsLowerCase() public function isLowerCaseProvider()
{ {
$testData = array( return array(
array(true, ''), array(true, ''),
array(true, 'foobar'), array(true, 'foobar'),
array(false, 'foo bar'), array(false, 'foo bar'),
@@ -841,13 +747,11 @@ abstract class CommonTest extends PHPUnit_Framework_TestCase
array(false, 'fòô bàř', 'UTF-8'), array(false, 'fòô bàř', 'UTF-8'),
array(false, 'fòôbÀŘ', 'UTF-8'), array(false, 'fòôbÀŘ', 'UTF-8'),
); );
return $testData;
} }
public function stringsForIsSerialized() public function isSerializedProvider()
{ {
$testData = array( return array(
array(false, ''), array(false, ''),
array(true, 'a:1:{s:3:"foo";s:3:"bar";}'), array(true, 'a:1:{s:3:"foo";s:3:"bar";}'),
array(false, 'a:1:{s:3:"foo";s:3:"bar"}'), array(false, 'a:1:{s:3:"foo";s:3:"bar"}'),
@@ -856,13 +760,11 @@ abstract class CommonTest extends PHPUnit_Framework_TestCase
array(false, 'a:1:{s:5:"fòô";s:5:"bàř"}', 'UTF-8'), array(false, 'a:1:{s:5:"fòô";s:5:"bàř"}', 'UTF-8'),
array(true, serialize(array('fòô' => 'bár')), 'UTF-8'), array(true, serialize(array('fòô' => 'bár')), 'UTF-8'),
); );
return $testData;
} }
public function stringsForIsUpperCase() public function isUpperCaseProvider()
{ {
$testData = array( return array(
array(true, ''), array(true, ''),
array(true, 'FOOBAR'), array(true, 'FOOBAR'),
array(false, 'FOO BAR'), array(false, 'FOO BAR'),
@@ -872,13 +774,11 @@ abstract class CommonTest extends PHPUnit_Framework_TestCase
array(false, 'FÒÔ BÀŘ', 'UTF-8'), array(false, 'FÒÔ BÀŘ', 'UTF-8'),
array(false, 'FÒÔBàř', 'UTF-8'), array(false, 'FÒÔBàř', 'UTF-8'),
); );
return $testData;
} }
public function stringsForIsHexadecimal() public function isHexadecimalProvider()
{ {
$testData = array( return array(
array(true, ''), array(true, ''),
array(true, 'abcdef'), array(true, 'abcdef'),
array(true, 'ABCDEF'), array(true, 'ABCDEF'),
@@ -893,13 +793,11 @@ abstract class CommonTest extends PHPUnit_Framework_TestCase
array(false, '0123456789x', 'UTF-8'), array(false, '0123456789x', 'UTF-8'),
array(false, 'ABCDEFx', 'UTF-8'), array(false, 'ABCDEFx', 'UTF-8'),
); );
return $testData;
} }
public function stringsForCount() public function countProvider()
{ {
$testData = array( return array(
array(0, '', 'foo'), array(0, '', 'foo'),
array(0, 'foo', 'bar'), array(0, 'foo', 'bar'),
array(1, 'foo bar', 'foo'), array(1, 'foo bar', 'foo'),
@@ -916,13 +814,11 @@ abstract class CommonTest extends PHPUnit_Framework_TestCase
array(2, 'fôòô bàř', 'Ô', false, 'UTF-8'), array(2, 'fôòô bàř', 'Ô', false, 'UTF-8'),
array(2, 'συγγραφέας', 'Σ', false, 'UTF-8') array(2, 'συγγραφέας', 'Σ', false, 'UTF-8')
); );
return $testData;
} }
public function stringsForReplace() public function replaceProvider()
{ {
$testData = array( return array(
array('', '', '', ''), array('', '', '', ''),
array('foo', '', '', 'foo'), array('foo', '', '', 'foo'),
array('foo', '\s', '\s', 'foo'), array('foo', '\s', '\s', 'foo'),
@@ -938,13 +834,11 @@ abstract class CommonTest extends PHPUnit_Framework_TestCase
array('far bàř', 'fòô bàř', 'fòô', 'far', 'UTF-8'), array('far bàř', 'fòô bàř', 'fòô', 'far', 'UTF-8'),
array('bàř bàř', 'fòô bàř fòô bàř', 'fòô ', '', 'UTF-8'), array('bàř bàř', 'fòô bàř fòô bàř', 'fòô ', '', 'UTF-8'),
); );
return $testData;
} }
public function stringsForRegexReplace() public function regexReplaceProvider()
{ {
$testData = array( return array(
array('', '', '', ''), array('', '', '', ''),
array('bar', 'foo', 'f[o]+', 'bar'), array('bar', 'foo', 'f[o]+', 'bar'),
array('bar', 'foo bar', 'f[O]+\s', '', 'i'), array('bar', 'foo bar', 'f[O]+\s', '', 'i'),
@@ -953,7 +847,5 @@ abstract class CommonTest extends PHPUnit_Framework_TestCase
array('bàř', 'fòô ', 'f[òô]+\s', 'bàř', 'msr', 'UTF-8'), array('bàř', 'fòô ', 'f[òô]+\s', 'bàř', 'msr', 'UTF-8'),
array('fòô', 'bàř', '[[:alpha:]]{3}', 'fòô', 'msr', 'UTF-8') array('fòô', 'bàř', '[[:alpha:]]{3}', 'fòô', 'msr', 'UTF-8')
); );
return $testData;
} }
} }

View File

@@ -8,7 +8,7 @@ use Stringy\StaticStringy as S;
class StaticStringyTestCase extends CommonTest class StaticStringyTestCase extends CommonTest
{ {
/** /**
* @dataProvider stringsForUpperCaseFirst * @dataProvider upperCaseFirstProvider()
*/ */
public function testUpperCaseFirst($expected, $str, $encoding = null) public function testUpperCaseFirst($expected, $str, $encoding = null)
{ {
@@ -18,7 +18,7 @@ class StaticStringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForLowerCaseFirst * @dataProvider lowerCaseFirstProvider()
*/ */
public function testLowerCaseFirst($expected, $str, $encoding = null) public function testLowerCaseFirst($expected, $str, $encoding = null)
{ {
@@ -28,7 +28,7 @@ class StaticStringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForCamelize * @dataProvider camelizeProvider()
*/ */
public function testCamelize($expected, $str, $encoding = null) public function testCamelize($expected, $str, $encoding = null)
{ {
@@ -38,7 +38,7 @@ class StaticStringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForUpperCamelize * @dataProvider upperCamelizeProvider()
*/ */
public function testUpperCamelize($expected, $str, $encoding = null) public function testUpperCamelize($expected, $str, $encoding = null)
{ {
@@ -48,7 +48,7 @@ class StaticStringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForDasherize * @dataProvider dasherizeProvider()
*/ */
public function testDasherize($expected, $str, $encoding = null) public function testDasherize($expected, $str, $encoding = null)
{ {
@@ -58,7 +58,7 @@ class StaticStringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForUnderscored * @dataProvider underscoredProvider()
*/ */
public function testUnderscored($expected, $str, $encoding = null) public function testUnderscored($expected, $str, $encoding = null)
{ {
@@ -68,7 +68,7 @@ class StaticStringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForSwapCase * @dataProvider swapCaseProvider()
*/ */
public function testSwapCase($expected, $str, $encoding = null) public function testSwapCase($expected, $str, $encoding = null)
{ {
@@ -78,7 +78,7 @@ class StaticStringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForTitleize * @dataProvider titleizeProvider()
*/ */
public function testTitleize($expected, $str, $ignore = null, public function testTitleize($expected, $str, $ignore = null,
$encoding = null) $encoding = null)
@@ -89,7 +89,7 @@ class StaticStringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForHumanize * @dataProvider humanizeProvider()
*/ */
public function testHumanize($expected, $str, $encoding = null) public function testHumanize($expected, $str, $encoding = null)
{ {
@@ -99,7 +99,7 @@ class StaticStringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForTidy * @dataProvider tidyProvider()
*/ */
public function testTidy($expected, $str) public function testTidy($expected, $str)
{ {
@@ -109,7 +109,7 @@ class StaticStringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForCollapseWhitespace * @dataProvider collapseWhitespaceProvider()
*/ */
public function testCollapseWhitespace($expected, $str, $encoding = null) public function testCollapseWhitespace($expected, $str, $encoding = null)
{ {
@@ -119,7 +119,7 @@ class StaticStringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForToAscii * @dataProvider toAsciiProvider()
*/ */
public function testToAscii($expected, $str) public function testToAscii($expected, $str)
{ {
@@ -129,7 +129,7 @@ class StaticStringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForPad * @dataProvider padProvider()
*/ */
public function testPad($expected, $str, $length, $padStr = ' ', public function testPad($expected, $str, $length, $padStr = ' ',
$padType = 'right', $encoding = null) $padType = 'right', $encoding = null)
@@ -148,7 +148,7 @@ class StaticStringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForPadLeft * @dataProvider padLeftProvider()
*/ */
public function testPadLeft($expected, $str, $length, $padStr = ' ', public function testPadLeft($expected, $str, $length, $padStr = ' ',
$encoding = null) $encoding = null)
@@ -159,7 +159,7 @@ class StaticStringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForPadRight * @dataProvider padRightProvider()
*/ */
public function testPadRight($expected, $str, $length, $padStr = ' ', public function testPadRight($expected, $str, $length, $padStr = ' ',
$encoding = null) $encoding = null)
@@ -170,7 +170,7 @@ class StaticStringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForPadBoth * @dataProvider padBothProvider()
*/ */
public function testPadBoth($expected, $str, $length, $padStr = ' ', public function testPadBoth($expected, $str, $length, $padStr = ' ',
$encoding = null) $encoding = null)
@@ -181,7 +181,7 @@ class StaticStringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForStartsWith * @dataProvider startsWithProvider()
*/ */
public function testStartsWith($expected, $str, $substring, public function testStartsWith($expected, $str, $substring,
$caseSensitive = true, $encoding = null) $caseSensitive = true, $encoding = null)
@@ -192,7 +192,7 @@ class StaticStringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForEndsWith * @dataProvider endsWithProvider()
*/ */
public function testEndsWith($expected, $str, $substring, public function testEndsWith($expected, $str, $substring,
$caseSensitive = true, $encoding = null) $caseSensitive = true, $encoding = null)
@@ -203,7 +203,7 @@ class StaticStringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForToSpaces * @dataProvider toSpacesProvider()
*/ */
public function testToSpaces($expected, $str, $tabLength = 4) public function testToSpaces($expected, $str, $tabLength = 4)
{ {
@@ -213,7 +213,7 @@ class StaticStringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForToTabs * @dataProvider toTabsProvider()
*/ */
public function testToTabs($expected, $str, $tabLength = 4) public function testToTabs($expected, $str, $tabLength = 4)
{ {
@@ -223,7 +223,7 @@ class StaticStringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForToLowerCase * @dataProvider toLowerCaseProvider()
*/ */
public function testToLowerCase($expected, $str, $encoding = null) public function testToLowerCase($expected, $str, $encoding = null)
{ {
@@ -233,7 +233,7 @@ class StaticStringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForToUpperCase * @dataProvider toUpperCaseProvider()
*/ */
public function testToUpperCase($expected, $str, $encoding = null) public function testToUpperCase($expected, $str, $encoding = null)
{ {
@@ -243,7 +243,7 @@ class StaticStringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForSlugify * @dataProvider slugifyProvider()
*/ */
public function testSlugify($expected, $str) public function testSlugify($expected, $str)
{ {
@@ -253,7 +253,7 @@ class StaticStringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForContains * @dataProvider containsProvider()
*/ */
public function testContains($expected, $haystack, $needle, public function testContains($expected, $haystack, $needle,
$caseSensitive = true, $encoding = null) $caseSensitive = true, $encoding = null)
@@ -264,7 +264,7 @@ class StaticStringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForSurround * @dataProvider surroundProvider()
*/ */
public function testSurround($expected, $str, $substring) public function testSurround($expected, $str, $substring)
{ {
@@ -274,7 +274,7 @@ class StaticStringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForInsert * @dataProvider insertProvider()
*/ */
public function testInsert($expected, $str, $substring, $index, public function testInsert($expected, $str, $substring, $index,
$encoding = null) $encoding = null)
@@ -285,7 +285,7 @@ class StaticStringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForTruncate * @dataProvider truncateProvider()
*/ */
public function testTruncate($expected, $str, $length, $substring = '', public function testTruncate($expected, $str, $length, $substring = '',
$encoding = null) $encoding = null)
@@ -296,7 +296,7 @@ class StaticStringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForSafeTruncate * @dataProvider safeTruncateProvider()
*/ */
public function testSafeTruncate($expected, $str, $length, $substring = '', public function testSafeTruncate($expected, $str, $length, $substring = '',
$encoding = null) $encoding = null)
@@ -307,7 +307,7 @@ class StaticStringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForReverse * @dataProvider reverseProvider()
*/ */
public function testReverse($expected, $str, $encoding = null) public function testReverse($expected, $str, $encoding = null)
{ {
@@ -317,7 +317,7 @@ class StaticStringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForShuffle * @dataProvider shuffleProvider()
*/ */
public function testShuffle($str, $encoding = null) public function testShuffle($str, $encoding = null)
{ {
@@ -338,7 +338,7 @@ class StaticStringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForTrim * @dataProvider trimProvider()
*/ */
public function testTrim($expected, $str) public function testTrim($expected, $str)
{ {
@@ -348,7 +348,7 @@ class StaticStringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForLongestCommonPrefix * @dataProvider longestCommonPrefixProvider()
*/ */
public function testLongestCommonPrefix($expected, $str, $otherStr, public function testLongestCommonPrefix($expected, $str, $otherStr,
$encoding = null) $encoding = null)
@@ -359,7 +359,7 @@ class StaticStringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForLongestCommonSuffix * @dataProvider longestCommonSuffixProvider()
*/ */
public function testLongestCommonSuffix($expected, $str, $otherStr, public function testLongestCommonSuffix($expected, $str, $otherStr,
$encoding = null) $encoding = null)
@@ -370,7 +370,7 @@ class StaticStringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForLongestCommonSubstring * @dataProvider longestCommonSubstringProvider()
*/ */
public function testLongestCommonSubstring($expected, $str, $otherStr, public function testLongestCommonSubstring($expected, $str, $otherStr,
$encoding = null) $encoding = null)
@@ -381,7 +381,7 @@ class StaticStringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForLength * @dataProvider lengthProvider()
*/ */
public function testLength($expected, $str, $encoding = null) public function testLength($expected, $str, $encoding = null)
{ {
@@ -391,7 +391,7 @@ class StaticStringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForSubstr * @dataProvider substrProvider()
*/ */
public function testSubstr($expected, $str, $start, $length = null, public function testSubstr($expected, $str, $start, $length = null,
$encoding = null) $encoding = null)
@@ -402,7 +402,7 @@ class StaticStringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForAt * @dataProvider atProvider()
*/ */
public function testAt($expected, $str, $index, $encoding = null) public function testAt($expected, $str, $index, $encoding = null)
{ {
@@ -412,7 +412,7 @@ class StaticStringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForFirst * @dataProvider firstProvider()
*/ */
public function testFirst($expected, $str, $n, $encoding = null) public function testFirst($expected, $str, $n, $encoding = null)
{ {
@@ -422,7 +422,7 @@ class StaticStringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForLast * @dataProvider lastProvider()
*/ */
public function testLast($expected, $str, $n, $encoding = null) public function testLast($expected, $str, $n, $encoding = null)
{ {
@@ -432,7 +432,7 @@ class StaticStringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForEnsureLeft * @dataProvider ensureLeftProvider()
*/ */
public function testEnsureLeft($expected, $str, $substring, $encoding = null) public function testEnsureLeft($expected, $str, $substring, $encoding = null)
{ {
@@ -442,7 +442,7 @@ class StaticStringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForEnsureRight * @dataProvider ensureRightProvider()
*/ */
public function testEnsureRight($expected, $str, $substring, $encoding = null) public function testEnsureRight($expected, $str, $substring, $encoding = null)
{ {
@@ -452,7 +452,7 @@ class StaticStringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForRemoveLeft * @dataProvider removeLeftProvider()
*/ */
public function testRemoveLeft($expected, $str, $substring, $encoding = null) public function testRemoveLeft($expected, $str, $substring, $encoding = null)
{ {
@@ -462,7 +462,7 @@ class StaticStringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForRemoveRight * @dataProvider removeRightProvider()
*/ */
public function testRemoveRight($expected, $str, $substring, $encoding = null) public function testRemoveRight($expected, $str, $substring, $encoding = null)
{ {
@@ -472,7 +472,7 @@ class StaticStringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForIsAlpha * @dataProvider isAlphaProvider()
*/ */
public function testIsAlpha($expected, $str, $encoding = null) public function testIsAlpha($expected, $str, $encoding = null)
{ {
@@ -482,7 +482,7 @@ class StaticStringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForIsAlphanumeric * @dataProvider isAlphanumericProvider()
*/ */
public function testIsAlphanumeric($expected, $str, $encoding = null) public function testIsAlphanumeric($expected, $str, $encoding = null)
{ {
@@ -492,7 +492,7 @@ class StaticStringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForIsBlank * @dataProvider isBlankProvider()
*/ */
public function testIsBlank($expected, $str, $encoding = null) public function testIsBlank($expected, $str, $encoding = null)
{ {
@@ -502,7 +502,7 @@ class StaticStringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForIsJson * @dataProvider isJsonProvider()
*/ */
public function testIsJson($expected, $str, $encoding = null) public function testIsJson($expected, $str, $encoding = null)
{ {
@@ -512,7 +512,7 @@ class StaticStringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForIsLowerCase * @dataProvider isLowerCaseProvider()
*/ */
public function testIsLowerCase($expected, $str, $encoding = null) public function testIsLowerCase($expected, $str, $encoding = null)
{ {
@@ -522,7 +522,7 @@ class StaticStringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForIsSerialized * @dataProvider isSerializedProvider()
*/ */
public function testIsSerialized($expected, $str, $encoding = null) public function testIsSerialized($expected, $str, $encoding = null)
{ {
@@ -532,7 +532,7 @@ class StaticStringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForIsUpperCase * @dataProvider isUpperCaseProvider()
*/ */
public function testIsUpperCase($expected, $str, $encoding = null) public function testIsUpperCase($expected, $str, $encoding = null)
{ {
@@ -542,7 +542,7 @@ class StaticStringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForIsHexadecimal * @dataProvider isHexadecimalProvider()
*/ */
public function testIsHexadecimal($expected, $str, $encoding = null) public function testIsHexadecimal($expected, $str, $encoding = null)
{ {
@@ -552,7 +552,7 @@ class StaticStringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForCount * @dataProvider countProvider()
*/ */
public function testCount($expected, $str, $substring, $caseSensitive = true, public function testCount($expected, $str, $substring, $caseSensitive = true,
$encoding = null) $encoding = null)
@@ -563,7 +563,7 @@ class StaticStringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForReplace * @dataProvider replaceProvider()
*/ */
public function testReplace($expected, $str, $search, $replacement, public function testReplace($expected, $str, $search, $replacement,
$encoding = null) $encoding = null)
@@ -574,7 +574,7 @@ class StaticStringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForRegexReplace * @dataProvider regexReplaceProvider()
*/ */
public function testRegexReplace($expected, $str, $pattern, $replacement, public function testRegexReplace($expected, $str, $pattern, $replacement,
$options = 'msr', $encoding = null) $options = 'msr', $encoding = null)

View File

@@ -32,7 +32,7 @@ class StringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForUpperCaseFirst * @dataProvider upperCaseFirstProvider()
*/ */
public function testUpperCaseFirst($expected, $str, $encoding = null) public function testUpperCaseFirst($expected, $str, $encoding = null)
{ {
@@ -42,7 +42,7 @@ class StringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForLowerCaseFirst * @dataProvider lowerCaseFirstProvider()
*/ */
public function testLowerCaseFirst($expected, $str, $encoding = null) public function testLowerCaseFirst($expected, $str, $encoding = null)
{ {
@@ -54,7 +54,7 @@ class StringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForCamelize * @dataProvider camelizeProvider()
*/ */
public function testCamelize($expected, $str, $encoding = null) public function testCamelize($expected, $str, $encoding = null)
{ {
@@ -66,7 +66,7 @@ class StringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForUpperCamelize * @dataProvider upperCamelizeProvider()
*/ */
public function testUpperCamelize($expected, $str, $encoding = null) public function testUpperCamelize($expected, $str, $encoding = null)
{ {
@@ -78,7 +78,7 @@ class StringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForDasherize * @dataProvider dasherizeProvider()
*/ */
public function testDasherize($expected, $str, $encoding = null) public function testDasherize($expected, $str, $encoding = null)
{ {
@@ -90,7 +90,7 @@ class StringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForUnderscored * @dataProvider underscoredProvider()
*/ */
public function testUnderscored($expected, $str, $encoding = null) public function testUnderscored($expected, $str, $encoding = null)
{ {
@@ -102,7 +102,7 @@ class StringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForSwapCase * @dataProvider swapCaseProvider()
*/ */
public function testSwapCase($expected, $str, $encoding = null) public function testSwapCase($expected, $str, $encoding = null)
{ {
@@ -114,7 +114,7 @@ class StringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForTitleize * @dataProvider titleizeProvider()
*/ */
public function testTitleize($expected, $str, $ignore = null, public function testTitleize($expected, $str, $ignore = null,
$encoding = null) $encoding = null)
@@ -127,7 +127,7 @@ class StringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForHumanize * @dataProvider humanizeProvider()
*/ */
public function testHumanize($expected, $str, $encoding = null) public function testHumanize($expected, $str, $encoding = null)
{ {
@@ -139,7 +139,7 @@ class StringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForTidy * @dataProvider tidyProvider()
*/ */
public function testTidy($expected, $str) public function testTidy($expected, $str)
{ {
@@ -151,7 +151,7 @@ class StringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForCollapseWhitespace * @dataProvider collapseWhitespaceProvider()
*/ */
public function testCollapseWhitespace($expected, $str, $encoding = null) public function testCollapseWhitespace($expected, $str, $encoding = null)
{ {
@@ -163,7 +163,7 @@ class StringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForToAscii * @dataProvider toAsciiProvider()
*/ */
public function testToAscii($expected, $str) public function testToAscii($expected, $str)
{ {
@@ -175,7 +175,7 @@ class StringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForPad * @dataProvider padProvider()
*/ */
public function testPad($expected, $str, $length, $padStr = ' ', public function testPad($expected, $str, $length, $padStr = ' ',
$padType = 'right', $encoding = null) $padType = 'right', $encoding = null)
@@ -197,7 +197,7 @@ class StringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForPadLeft * @dataProvider padLeftProvider()
*/ */
public function testPadLeft($expected, $str, $length, $padStr = ' ', public function testPadLeft($expected, $str, $length, $padStr = ' ',
$encoding = null) $encoding = null)
@@ -210,7 +210,7 @@ class StringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForPadRight * @dataProvider padRightProvider()
*/ */
public function testPadRight($expected, $str, $length, $padStr = ' ', public function testPadRight($expected, $str, $length, $padStr = ' ',
$encoding = null) $encoding = null)
@@ -223,7 +223,7 @@ class StringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForPadBoth * @dataProvider padBothProvider()
*/ */
public function testPadBoth($expected, $str, $length, $padStr = ' ', public function testPadBoth($expected, $str, $length, $padStr = ' ',
$encoding = null) $encoding = null)
@@ -236,7 +236,7 @@ class StringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForStartsWith * @dataProvider startsWithProvider()
*/ */
public function testStartsWith($expected, $str, $substring, public function testStartsWith($expected, $str, $substring,
$caseSensitive = true, $encoding = null) $caseSensitive = true, $encoding = null)
@@ -249,7 +249,7 @@ class StringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForEndsWith * @dataProvider endsWithProvider()
*/ */
public function testEndsWith($expected, $str, $substring, public function testEndsWith($expected, $str, $substring,
$caseSensitive = true, $encoding = null) $caseSensitive = true, $encoding = null)
@@ -262,7 +262,7 @@ class StringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForToSpaces * @dataProvider toSpacesProvider()
*/ */
public function testToSpaces($expected, $str, $tabLength = 4) public function testToSpaces($expected, $str, $tabLength = 4)
{ {
@@ -274,7 +274,7 @@ class StringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForToTabs * @dataProvider toTabsProvider()
*/ */
public function testToTabs($expected, $str, $tabLength = 4) public function testToTabs($expected, $str, $tabLength = 4)
{ {
@@ -286,7 +286,7 @@ class StringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForToLowerCase * @dataProvider toLowerCaseProvider()
*/ */
public function testToLowerCase($expected, $str, $encoding = null) public function testToLowerCase($expected, $str, $encoding = null)
{ {
@@ -298,7 +298,7 @@ class StringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForToUpperCase * @dataProvider toUpperCaseProvider()
*/ */
public function testToUpperCase($expected, $str, $encoding = null) public function testToUpperCase($expected, $str, $encoding = null)
{ {
@@ -310,7 +310,7 @@ class StringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForSlugify * @dataProvider slugifyProvider()
*/ */
public function testSlugify($expected, $str) public function testSlugify($expected, $str)
{ {
@@ -322,7 +322,7 @@ class StringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForContains * @dataProvider containsProvider()
*/ */
public function testContains($expected, $haystack, $needle, public function testContains($expected, $haystack, $needle,
$caseSensitive = true, $encoding = null) $caseSensitive = true, $encoding = null)
@@ -335,7 +335,7 @@ class StringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForSurround * @dataProvider surroundProvider()
*/ */
public function testSurround($expected, $str, $substring) public function testSurround($expected, $str, $substring)
{ {
@@ -347,7 +347,7 @@ class StringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForInsert * @dataProvider insertProvider()
*/ */
public function testInsert($expected, $str, $substring, $index, public function testInsert($expected, $str, $substring, $index,
$encoding = null) $encoding = null)
@@ -360,7 +360,7 @@ class StringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForTruncate * @dataProvider truncateProvider()
*/ */
public function testTruncate($expected, $str, $length, $substring = '', public function testTruncate($expected, $str, $length, $substring = '',
$encoding = null) $encoding = null)
@@ -373,7 +373,7 @@ class StringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForReverse * @dataProvider reverseProvider()
*/ */
public function testReverse($expected, $str, $encoding = null) public function testReverse($expected, $str, $encoding = null)
{ {
@@ -385,7 +385,7 @@ class StringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForShuffle * @dataProvider shuffleProvider()
*/ */
public function testShuffle($str, $encoding = null) public function testShuffle($str, $encoding = null)
{ {
@@ -408,7 +408,7 @@ class StringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForTrim * @dataProvider trimProvider()
*/ */
public function testTrim($expected, $str) public function testTrim($expected, $str)
{ {
@@ -420,7 +420,7 @@ class StringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForLongestCommonPrefix * @dataProvider longestCommonPrefixProvider()
*/ */
public function testLongestCommonPrefix($expected, $str, $otherStr, public function testLongestCommonPrefix($expected, $str, $otherStr,
$encoding = null) $encoding = null)
@@ -433,7 +433,7 @@ class StringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForLongestCommonSubstring * @dataProvider longestCommonSubstringProvider()
*/ */
public function testLongestCommonSubstring($expected, $str, $otherStr, public function testLongestCommonSubstring($expected, $str, $otherStr,
$encoding = null) $encoding = null)
@@ -446,7 +446,7 @@ class StringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForLength * @dataProvider lengthProvider()
*/ */
public function testLength($expected, $str, $encoding = null) public function testLength($expected, $str, $encoding = null)
{ {
@@ -458,7 +458,7 @@ class StringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForSubstr * @dataProvider substrProvider()
*/ */
public function testSubstr($expected, $str, $start, $length = null, public function testSubstr($expected, $str, $start, $length = null,
$encoding = null) $encoding = null)
@@ -471,7 +471,7 @@ class StringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForAt * @dataProvider atProvider()
*/ */
public function testAt($expected, $str, $index, $encoding = null) public function testAt($expected, $str, $index, $encoding = null)
{ {
@@ -483,7 +483,7 @@ class StringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForFirst * @dataProvider firstProvider()
*/ */
public function testFirst($expected, $str, $n, $encoding = null) public function testFirst($expected, $str, $n, $encoding = null)
{ {
@@ -495,7 +495,7 @@ class StringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForLast * @dataProvider lastProvider()
*/ */
public function testLast($expected, $str, $n, $encoding = null) public function testLast($expected, $str, $n, $encoding = null)
{ {
@@ -507,7 +507,7 @@ class StringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForEnsureLeft * @dataProvider ensureLeftProvider()
*/ */
public function testEnsureLeft($expected, $str, $substring, $encoding = null) public function testEnsureLeft($expected, $str, $substring, $encoding = null)
{ {
@@ -519,7 +519,7 @@ class StringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForEnsureRight * @dataProvider ensureRightProvider()
*/ */
public function testEnsureRight($expected, $str, $substring, $encoding = null) public function testEnsureRight($expected, $str, $substring, $encoding = null)
{ {
@@ -531,7 +531,7 @@ class StringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForRemoveLeft * @dataProvider removeLeftProvider()
*/ */
public function testRemoveLeft($expected, $str, $substring, $encoding = null) public function testRemoveLeft($expected, $str, $substring, $encoding = null)
{ {
@@ -543,7 +543,7 @@ class StringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForRemoveRight * @dataProvider removeRightProvider()
*/ */
public function testRemoveRight($expected, $str, $substring, $encoding = null) public function testRemoveRight($expected, $str, $substring, $encoding = null)
{ {
@@ -555,7 +555,7 @@ class StringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForIsAlpha * @dataProvider isAlphaProvider()
*/ */
public function testIsAlpha($expected, $str, $encoding = null) public function testIsAlpha($expected, $str, $encoding = null)
{ {
@@ -567,7 +567,7 @@ class StringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForIsAlphanumeric * @dataProvider isAlphanumericProvider()
*/ */
public function testIsAlphanumeric($expected, $str, $encoding = null) public function testIsAlphanumeric($expected, $str, $encoding = null)
{ {
@@ -579,7 +579,7 @@ class StringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForIsBlank * @dataProvider isBlankProvider()
*/ */
public function testIsBlank($expected, $str, $encoding = null) public function testIsBlank($expected, $str, $encoding = null)
{ {
@@ -591,7 +591,7 @@ class StringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForIsJson * @dataProvider isJsonProvider()
*/ */
public function testIsJson($expected, $str, $encoding = null) public function testIsJson($expected, $str, $encoding = null)
{ {
@@ -603,7 +603,7 @@ class StringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForIsLowerCase * @dataProvider isLowerCaseProvider()
*/ */
public function testIsLowerCase($expected, $str, $encoding = null) public function testIsLowerCase($expected, $str, $encoding = null)
{ {
@@ -615,7 +615,7 @@ class StringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForIsSerialized * @dataProvider isSerializedProvider()
*/ */
public function testIsSerialized($expected, $str, $encoding = null) public function testIsSerialized($expected, $str, $encoding = null)
{ {
@@ -627,7 +627,7 @@ class StringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForIsUpperCase * @dataProvider isUpperCaseProvider()
*/ */
public function testIsUpperCase($expected, $str, $encoding = null) public function testIsUpperCase($expected, $str, $encoding = null)
{ {
@@ -639,7 +639,7 @@ class StringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForIsHexadecimal * @dataProvider isHexadecimalProvider()
*/ */
public function testIsHexadecimal($expected, $str, $encoding = null) public function testIsHexadecimal($expected, $str, $encoding = null)
{ {
@@ -651,7 +651,7 @@ class StringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForCount * @dataProvider countProvider()
*/ */
public function testCount($expected, $str, $substring, $caseSensitive = true, public function testCount($expected, $str, $substring, $caseSensitive = true,
$encoding = null) $encoding = null)
@@ -664,7 +664,7 @@ class StringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForReplace * @dataProvider replaceProvider()
*/ */
public function testReplace($expected, $str, $search, $replacement, public function testReplace($expected, $str, $search, $replacement,
$encoding = null) $encoding = null)
@@ -677,7 +677,7 @@ class StringyTestCase extends CommonTest
} }
/** /**
* @dataProvider stringsForRegexReplace * @dataProvider regexReplaceProvider()
*/ */
public function testregexReplace($expected, $str, $pattern, $replacement, public function testregexReplace($expected, $str, $pattern, $replacement,
$options = 'msr', $encoding = null) $options = 'msr', $encoding = null)