endtoend-test-psl/tests/Psl/Str/ToIntTest.php
2020-01-02 00:00:08 +01:00

32 lines
564 B
PHP

<?php
declare(strict_types=1);
namespace Psl\Tests\Str;
use PHPUnit\Framework\TestCase;
use Psl\Str;
class ToIntTest extends TestCase
{
/**
* @dataProvider provideData
*/
public function testToInt(?int $expected, string $string): void
{
self::assertSame($expected, Str\to_int($string));
}
public function provideData(): array
{
return [
[null, 'hello'],
[1, '1'],
[525, '525'],
[0, '0'],
[null, '0e'],
[null, '12e1'],
];
}
}