2017-05-18 21:26:34 +00:00
|
|
|
<?php
|
|
|
|
declare(strict_types = 1);
|
|
|
|
|
|
|
|
namespace LanguageServer\Tests\Utils;
|
|
|
|
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
use function LanguageServer\{strStartsWith};
|
|
|
|
|
|
|
|
class UtilsTest extends TestCase
|
|
|
|
{
|
2017-05-25 18:39:42 +00:00
|
|
|
public function testStrStartsWithDataProvider(): array
|
|
|
|
{
|
2017-05-18 21:26:34 +00:00
|
|
|
return [
|
|
|
|
['a', 'b', false],
|
|
|
|
['', 'a', false],
|
|
|
|
['foobar', 'bar', false],
|
|
|
|
|
|
|
|
['a', '', true],
|
|
|
|
['', '', true],
|
|
|
|
|
|
|
|
['foobar', 'foob', true],
|
|
|
|
['foobar', 'f', true],
|
|
|
|
['FOOBAR', 'foo', false],
|
|
|
|
['foobar', 'foobar', true]
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @dataProvider testStrStartsWithDataProvider
|
|
|
|
*/
|
|
|
|
public function testStrStartsWith($haystack, $prefix, $expectedResult)
|
|
|
|
{
|
|
|
|
$this->assertEquals(strStartsWith($haystack, $prefix), $expectedResult);
|
|
|
|
}
|
|
|
|
}
|