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

Merge pull request #64 from vlakoff/tests

Add missing tests in StringyTest
This commit is contained in:
Daniel St. Jules
2015-01-06 13:42:20 -08:00

View File

@@ -545,6 +545,19 @@ class StringyTestCase extends CommonTest
$this->assertEquals($str, $stringy); $this->assertEquals($str, $stringy);
} }
/**
* @dataProvider safeTruncateProvider()
*/
public function testSafeTruncate($expected, $str, $length, $substring = '',
$encoding = null)
{
$stringy = S::create($str, $encoding);
$result = $stringy->safeTruncate($length, $substring);
$this->assertStringy($result);
$this->assertEquals($expected, $result);
$this->assertEquals($str, $stringy);
}
/** /**
* @dataProvider reverseProvider() * @dataProvider reverseProvider()
*/ */
@@ -605,6 +618,19 @@ class StringyTestCase extends CommonTest
$this->assertEquals($str, $stringy); $this->assertEquals($str, $stringy);
} }
/**
* @dataProvider longestCommonSuffixProvider()
*/
public function testLongestCommonSuffix($expected, $str, $otherStr,
$encoding = null)
{
$stringy = S::create($str, $encoding);
$result = $stringy->longestCommonSuffix($otherStr);
$this->assertStringy($result);
$this->assertEquals($expected, $result);
$this->assertEquals($str, $stringy);
}
/** /**
* @dataProvider longestCommonSubstringProvider() * @dataProvider longestCommonSubstringProvider()
*/ */