mirror of
https://github.com/danielstjules/Stringy.git
synced 2025-08-06 21:36:31 +02:00
Breaking change: Fix docs, force static methods to return strings
rather than Stringy instances
This commit is contained in:
@@ -15,25 +15,38 @@ class StaticStringyTestCase extends PHPUnit_Framework_TestCase
|
||||
public function testEmptyArgsInvocation()
|
||||
{
|
||||
$result = S::toLowerCase();
|
||||
$this->assertEquals('', (string) $result);
|
||||
$this->assertEquals('', $result);
|
||||
}
|
||||
|
||||
public function testInvocation()
|
||||
{
|
||||
$result = S::toLowerCase('FOOBAR');
|
||||
$this->assertEquals('foobar', (string) $result);
|
||||
$this->assertEquals('foobar', $result);
|
||||
$this->assertInternalType('string', $result);
|
||||
}
|
||||
|
||||
public function testPartialArgsInvocation()
|
||||
{
|
||||
$result = S::slice('foobar', 0, 3);
|
||||
$this->assertEquals('foo', (string) $result);
|
||||
$this->assertEquals('foo', $result);
|
||||
$this->assertInternalType('string', $result);
|
||||
}
|
||||
|
||||
public function testFullArgsInvocation()
|
||||
{
|
||||
$result = S::slice('fòôbàř', 0, 3, 'UTF-8');
|
||||
$this->assertEquals('fòô', (string) $result);
|
||||
$this->assertEquals('fòô', $result);
|
||||
$this->assertInternalType('string', $result);
|
||||
}
|
||||
|
||||
public function testArrayReturnValue()
|
||||
{
|
||||
$result = S::lines("a\nb");
|
||||
$this->assertEquals(['a', 'b'], $result);
|
||||
$this->assertInternalType('array', $result);
|
||||
foreach ($result as $val) {
|
||||
$this->assertInternalType('string', $val);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user