@@ 504-511 (lines=8) @@ | ||
501 | /** |
|
502 | * @dataProvider delimitProvider() |
|
503 | */ |
|
504 | public function testDelimit($expected, $str, $delimiter, $encoding = null) |
|
505 | { |
|
506 | $stringy = S::create($str, $encoding); |
|
507 | $result = $stringy->delimit($delimiter); |
|
508 | $this->assertStringy($result); |
|
509 | $this->assertEquals($expected, $result); |
|
510 | $this->assertEquals($str, $stringy); |
|
511 | } |
|
512 | ||
513 | public function delimitProvider() |
|
514 | { |
|
@@ 693-701 (lines=9) @@ | ||
690 | /** |
|
691 | * @dataProvider padProvider() |
|
692 | */ |
|
693 | public function testPad($expected, $str, $length, $padStr = ' ', |
|
694 | $padType = 'right', $encoding = null) |
|
695 | { |
|
696 | $stringy = S::create($str, $encoding); |
|
697 | $result = $stringy->pad($length, $padStr, $padType); |
|
698 | $this->assertStringy($result); |
|
699 | $this->assertEquals($expected, $result); |
|
700 | $this->assertEquals($str, $stringy); |
|
701 | } |
|
702 | ||
703 | public function padProvider() |
|
704 | { |
|
@@ 740-748 (lines=9) @@ | ||
737 | /** |
|
738 | * @dataProvider padLeftProvider() |
|
739 | */ |
|
740 | public function testPadLeft($expected, $str, $length, $padStr = ' ', |
|
741 | $encoding = null) |
|
742 | { |
|
743 | $stringy = S::create($str, $encoding); |
|
744 | $result = $stringy->padLeft($length, $padStr); |
|
745 | $this->assertStringy($result); |
|
746 | $this->assertEquals($expected, $result); |
|
747 | $this->assertEquals($str, $stringy); |
|
748 | } |
|
749 | ||
750 | public function padLeftProvider() |
|
751 | { |
|
@@ 766-774 (lines=9) @@ | ||
763 | /** |
|
764 | * @dataProvider padRightProvider() |
|
765 | */ |
|
766 | public function testPadRight($expected, $str, $length, $padStr = ' ', |
|
767 | $encoding = null) |
|
768 | { |
|
769 | $stringy = S::create($str, $encoding); |
|
770 | $result = $stringy->padRight($length, $padStr); |
|
771 | $this->assertStringy($result); |
|
772 | $this->assertEquals($expected, $result); |
|
773 | $this->assertEquals($str, $stringy); |
|
774 | } |
|
775 | ||
776 | public function padRightProvider() |
|
777 | { |
|
@@ 792-800 (lines=9) @@ | ||
789 | /** |
|
790 | * @dataProvider padBothProvider() |
|
791 | */ |
|
792 | public function testPadBoth($expected, $str, $length, $padStr = ' ', |
|
793 | $encoding = null) |
|
794 | { |
|
795 | $stringy = S::create($str, $encoding); |
|
796 | $result = $stringy->padBoth($length, $padStr); |
|
797 | $this->assertStringy($result); |
|
798 | $this->assertEquals($expected, $result); |
|
799 | $this->assertEquals($str, $stringy); |
|
800 | } |
|
801 | ||
802 | public function padBothProvider() |
|
803 | { |
|
@@ 1064-1072 (lines=9) @@ | ||
1061 | /** |
|
1062 | * @dataProvider betweenProvider() |
|
1063 | */ |
|
1064 | public function testBetween($expected, $str, $start, $end, $offset = null, |
|
1065 | $encoding = null) |
|
1066 | { |
|
1067 | $stringy = S::create($str, $encoding); |
|
1068 | $result = $stringy->between($start, $end, $offset); |
|
1069 | $this->assertStringy($result); |
|
1070 | $this->assertEquals($expected, $result); |
|
1071 | $this->assertEquals($str, $stringy); |
|
1072 | } |
|
1073 | ||
1074 | public function betweenProvider() |
|
1075 | { |
|
@@ 1264-1272 (lines=9) @@ | ||
1261 | /** |
|
1262 | * @dataProvider insertProvider() |
|
1263 | */ |
|
1264 | public function testInsert($expected, $str, $substring, $index, |
|
1265 | $encoding = null) |
|
1266 | { |
|
1267 | $stringy = S::create($str, $encoding); |
|
1268 | $result = $stringy->insert($substring, $index); |
|
1269 | $this->assertStringy($result); |
|
1270 | $this->assertEquals($expected, $result); |
|
1271 | $this->assertEquals($str, $stringy); |
|
1272 | } |
|
1273 | ||
1274 | public function insertProvider() |
|
1275 | { |
|
@@ 1291-1299 (lines=9) @@ | ||
1288 | /** |
|
1289 | * @dataProvider truncateProvider() |
|
1290 | */ |
|
1291 | public function testTruncate($expected, $str, $length, $substring = '', |
|
1292 | $encoding = null) |
|
1293 | { |
|
1294 | $stringy = S::create($str, $encoding); |
|
1295 | $result = $stringy->truncate($length, $substring); |
|
1296 | $this->assertStringy($result); |
|
1297 | $this->assertEquals($expected, $result); |
|
1298 | $this->assertEquals($str, $stringy); |
|
1299 | } |
|
1300 | ||
1301 | public function truncateProvider() |
|
1302 | { |
|
@@ 1332-1340 (lines=9) @@ | ||
1329 | /** |
|
1330 | * @dataProvider safeTruncateProvider() |
|
1331 | */ |
|
1332 | public function testSafeTruncate($expected, $str, $length, $substring = '', |
|
1333 | $encoding = null) |
|
1334 | { |
|
1335 | $stringy = S::create($str, $encoding); |
|
1336 | $result = $stringy->safeTruncate($length, $substring); |
|
1337 | $this->assertStringy($result); |
|
1338 | $this->assertEquals($expected, $result); |
|
1339 | $this->assertEquals($str, $stringy); |
|
1340 | } |
|
1341 | ||
1342 | public function safeTruncateProvider() |
|
1343 | { |
|
@@ 1396-1403 (lines=8) @@ | ||
1393 | /** |
|
1394 | * @dataProvider repeatProvider() |
|
1395 | */ |
|
1396 | public function testRepeat($expected, $str, $multiplier, $encoding = null) |
|
1397 | { |
|
1398 | $stringy = S::create($str, $encoding); |
|
1399 | $result = $stringy->repeat($multiplier); |
|
1400 | $this->assertStringy($result); |
|
1401 | $this->assertEquals($expected, $result); |
|
1402 | $this->assertEquals($str, $stringy); |
|
1403 | } |
|
1404 | ||
1405 | public function repeatProvider() |
|
1406 | { |
|
@@ 1547-1555 (lines=9) @@ | ||
1544 | /** |
|
1545 | * @dataProvider longestCommonPrefixProvider() |
|
1546 | */ |
|
1547 | public function testLongestCommonPrefix($expected, $str, $otherStr, |
|
1548 | $encoding = null) |
|
1549 | { |
|
1550 | $stringy = S::create($str, $encoding); |
|
1551 | $result = $stringy->longestCommonPrefix($otherStr); |
|
1552 | $this->assertStringy($result); |
|
1553 | $this->assertEquals($expected, $result); |
|
1554 | $this->assertEquals($str, $stringy); |
|
1555 | } |
|
1556 | ||
1557 | public function longestCommonPrefixProvider() |
|
1558 | { |
|
@@ 1576-1584 (lines=9) @@ | ||
1573 | /** |
|
1574 | * @dataProvider longestCommonSuffixProvider() |
|
1575 | */ |
|
1576 | public function testLongestCommonSuffix($expected, $str, $otherStr, |
|
1577 | $encoding = null) |
|
1578 | { |
|
1579 | $stringy = S::create($str, $encoding); |
|
1580 | $result = $stringy->longestCommonSuffix($otherStr); |
|
1581 | $this->assertStringy($result); |
|
1582 | $this->assertEquals($expected, $result); |
|
1583 | $this->assertEquals($str, $stringy); |
|
1584 | } |
|
1585 | ||
1586 | public function longestCommonSuffixProvider() |
|
1587 | { |
|
@@ 1605-1613 (lines=9) @@ | ||
1602 | /** |
|
1603 | * @dataProvider longestCommonSubstringProvider() |
|
1604 | */ |
|
1605 | public function testLongestCommonSubstring($expected, $str, $otherStr, |
|
1606 | $encoding = null) |
|
1607 | { |
|
1608 | $stringy = S::create($str, $encoding); |
|
1609 | $result = $stringy->longestCommonSubstring($otherStr); |
|
1610 | $this->assertStringy($result); |
|
1611 | $this->assertEquals($expected, $result); |
|
1612 | $this->assertEquals($str, $stringy); |
|
1613 | } |
|
1614 | ||
1615 | public function longestCommonSubstringProvider() |
|
1616 | { |
|
@@ 1656-1664 (lines=9) @@ | ||
1653 | /** |
|
1654 | * @dataProvider sliceProvider() |
|
1655 | */ |
|
1656 | public function testSlice($expected, $str, $start, $end = null, |
|
1657 | $encoding = null) |
|
1658 | { |
|
1659 | $stringy = S::create($str, $encoding); |
|
1660 | $result = $stringy->slice($start, $end); |
|
1661 | $this->assertStringy($result); |
|
1662 | $this->assertEquals($expected, $result); |
|
1663 | $this->assertEquals($str, $stringy); |
|
1664 | } |
|
1665 | ||
1666 | public function sliceProvider() |
|
1667 | { |
|
@@ 1735-1743 (lines=9) @@ | ||
1732 | /** |
|
1733 | * @dataProvider substrProvider() |
|
1734 | */ |
|
1735 | public function testSubstr($expected, $str, $start, $length = null, |
|
1736 | $encoding = null) |
|
1737 | { |
|
1738 | $stringy = S::create($str, $encoding); |
|
1739 | $result = $stringy->substr($start, $length); |
|
1740 | $this->assertStringy($result); |
|
1741 | $this->assertEquals($expected, $result); |
|
1742 | $this->assertEquals($str, $stringy); |
|
1743 | } |
|
1744 | ||
1745 | public function substrProvider() |
|
1746 | { |
|
@@ 1763-1770 (lines=8) @@ | ||
1760 | /** |
|
1761 | * @dataProvider atProvider() |
|
1762 | */ |
|
1763 | public function testAt($expected, $str, $index, $encoding = null) |
|
1764 | { |
|
1765 | $stringy = S::create($str, $encoding); |
|
1766 | $result = $stringy->at($index); |
|
1767 | $this->assertStringy($result); |
|
1768 | $this->assertEquals($expected, $result); |
|
1769 | $this->assertEquals($str, $stringy); |
|
1770 | } |
|
1771 | ||
1772 | public function atProvider() |
|
1773 | { |
|
@@ 1789-1796 (lines=8) @@ | ||
1786 | /** |
|
1787 | * @dataProvider firstProvider() |
|
1788 | */ |
|
1789 | public function testFirst($expected, $str, $n, $encoding = null) |
|
1790 | { |
|
1791 | $stringy = S::create($str, $encoding); |
|
1792 | $result = $stringy->first($n); |
|
1793 | $this->assertStringy($result); |
|
1794 | $this->assertEquals($expected, $result); |
|
1795 | $this->assertEquals($str, $stringy); |
|
1796 | } |
|
1797 | ||
1798 | public function firstProvider() |
|
1799 | { |
|
@@ 1819-1826 (lines=8) @@ | ||
1816 | /** |
|
1817 | * @dataProvider lastProvider() |
|
1818 | */ |
|
1819 | public function testLast($expected, $str, $n, $encoding = null) |
|
1820 | { |
|
1821 | $stringy = S::create($str, $encoding); |
|
1822 | $result = $stringy->last($n); |
|
1823 | $this->assertStringy($result); |
|
1824 | $this->assertEquals($expected, $result); |
|
1825 | $this->assertEquals($str, $stringy); |
|
1826 | } |
|
1827 | ||
1828 | public function lastProvider() |
|
1829 | { |
|
@@ 1849-1856 (lines=8) @@ | ||
1846 | /** |
|
1847 | * @dataProvider ensureLeftProvider() |
|
1848 | */ |
|
1849 | public function testEnsureLeft($expected, $str, $substring, $encoding = null) |
|
1850 | { |
|
1851 | $stringy = S::create($str, $encoding); |
|
1852 | $result = $stringy->ensureLeft($substring); |
|
1853 | $this->assertStringy($result); |
|
1854 | $this->assertEquals($expected, $result); |
|
1855 | $this->assertEquals($str, $stringy); |
|
1856 | } |
|
1857 | ||
1858 | public function ensureLeftProvider() |
|
1859 | { |
|
@@ 1877-1884 (lines=8) @@ | ||
1874 | /** |
|
1875 | * @dataProvider ensureRightProvider() |
|
1876 | */ |
|
1877 | public function testEnsureRight($expected, $str, $substring, $encoding = null) |
|
1878 | { |
|
1879 | $stringy = S::create($str, $encoding); |
|
1880 | $result = $stringy->ensureRight($substring); |
|
1881 | $this->assertStringy($result); |
|
1882 | $this->assertEquals($expected, $result); |
|
1883 | $this->assertEquals($str, $stringy); |
|
1884 | } |
|
1885 | ||
1886 | public function ensureRightProvider() |
|
1887 | { |
|
@@ 1905-1912 (lines=8) @@ | ||
1902 | /** |
|
1903 | * @dataProvider removeLeftProvider() |
|
1904 | */ |
|
1905 | public function testRemoveLeft($expected, $str, $substring, $encoding = null) |
|
1906 | { |
|
1907 | $stringy = S::create($str, $encoding); |
|
1908 | $result = $stringy->removeLeft($substring); |
|
1909 | $this->assertStringy($result); |
|
1910 | $this->assertEquals($expected, $result); |
|
1911 | $this->assertEquals($str, $stringy); |
|
1912 | } |
|
1913 | ||
1914 | public function removeLeftProvider() |
|
1915 | { |
|
@@ 1935-1942 (lines=8) @@ | ||
1932 | /** |
|
1933 | * @dataProvider removeRightProvider() |
|
1934 | */ |
|
1935 | public function testRemoveRight($expected, $str, $substring, $encoding = null) |
|
1936 | { |
|
1937 | $stringy = S::create($str, $encoding); |
|
1938 | $result = $stringy->removeRight($substring); |
|
1939 | $this->assertStringy($result); |
|
1940 | $this->assertEquals($expected, $result); |
|
1941 | $this->assertEquals($str, $stringy); |
|
1942 | } |
|
1943 | ||
1944 | public function removeRightProvider() |
|
1945 | { |
|
@@ 2291-2299 (lines=9) @@ | ||
2288 | /** |
|
2289 | * @dataProvider replaceProvider() |
|
2290 | */ |
|
2291 | public function testReplace($expected, $str, $search, $replacement, |
|
2292 | $encoding = null) |
|
2293 | { |
|
2294 | $stringy = S::create($str, $encoding); |
|
2295 | $result = $stringy->replace($search, $replacement); |
|
2296 | $this->assertStringy($result); |
|
2297 | $this->assertEquals($expected, $result); |
|
2298 | $this->assertEquals($str, $stringy); |
|
2299 | } |
|
2300 | ||
2301 | public function replaceProvider() |
|
2302 | { |
|
@@ 2326-2334 (lines=9) @@ | ||
2323 | /** |
|
2324 | * @dataProvider regexReplaceProvider() |
|
2325 | */ |
|
2326 | public function testregexReplace($expected, $str, $pattern, $replacement, |
|
2327 | $options = 'msr', $encoding = null) |
|
2328 | { |
|
2329 | $stringy = S::create($str, $encoding); |
|
2330 | $result = $stringy->regexReplace($pattern, $replacement, $options); |
|
2331 | $this->assertStringy($result); |
|
2332 | $this->assertEquals($expected, $result); |
|
2333 | $this->assertEquals($str, $stringy); |
|
2334 | } |
|
2335 | ||
2336 | public function regexReplaceProvider() |
|
2337 | { |