mirror of
https://github.com/danog/endtoend-test-psl.git
synced 2024-12-12 09:09:45 +01:00
32 lines
572 B
PHP
32 lines
572 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Psl\Tests\Str;
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
use Psl\Str;
|
|
|
|
final class ToIntTest extends TestCase
|
|
{
|
|
/**
|
|
* @dataProvider provideData
|
|
*/
|
|
public function testToInt(?int $expected, string $string): void
|
|
{
|
|
static::assertSame($expected, Str\to_int($string));
|
|
}
|
|
|
|
public function provideData(): array
|
|
{
|
|
return [
|
|
[null, 'hello'],
|
|
[1, '1'],
|
|
[525, '525'],
|
|
[0, '0'],
|
|
[null, '0e'],
|
|
[null, '12e1'],
|
|
];
|
|
}
|
|
}
|