misc_pterodactyl-panel/tests/Unit/Helpers/IsDigitTest.php

49 lines
1.1 KiB
PHP
Raw Normal View History

2017-09-15 04:18:01 +00:00
<?php
namespace Pterodactyl\Tests\Unit\Helpers;
2017-09-15 04:18:01 +00:00
use Pterodactyl\Tests\TestCase;
2017-09-15 04:18:01 +00:00
class IsDigitTest extends TestCase
{
/**
* Test the is_digit helper.
*
* @dataProvider helperDataProvider
*/
public function testHelper($value, $response)
{
$this->assertSame($response, is_digit($value));
}
/**
2018-05-13 14:50:56 +00:00
* Provide data to test against the helper function.
2017-09-15 04:18:01 +00:00
*/
2023-02-23 19:30:16 +00:00
public static function helperDataProvider(): array
2017-09-15 04:18:01 +00:00
{
return [
[true, false],
[false, false],
[12.3, false],
['12.3', false],
['string', false],
[-1, false],
['-1', false],
[1, true],
[0, true],
[12345, true],
['12345', true],
['true', false],
['false', false],
['123_test', false],
['123.test', false],
['123test', false],
['test123', false],
['0x00000003', false],
[00000011, true],
['00000011', true],
['AD9C', false],
];
}
}