mirror of
https://github.com/danog/endtoend-test-psl.git
synced 2024-12-11 16:49:40 +01:00
32 lines
564 B
PHP
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'],
|
|
];
|
|
}
|
|
}
|