Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
pterodactyl
GitHub Repository: pterodactyl/panel
Path: blob/1.0-develop/tests/Unit/Helpers/IsDigitTest.php
7461 views
1
<?php
2
3
namespace Pterodactyl\Tests\Unit\Helpers;
4
5
use Pterodactyl\Tests\TestCase;
6
7
class IsDigitTest extends TestCase
8
{
9
/**
10
* Test the is_digit helper.
11
*/
12
#[\PHPUnit\Framework\Attributes\DataProvider('helperDataProvider')]
13
public function testHelper($value, $response)
14
{
15
$this->assertSame($response, is_digit($value));
16
}
17
18
/**
19
* Provide data to test against the helper function.
20
*/
21
public static function helperDataProvider(): array
22
{
23
return [
24
[true, false],
25
[false, false],
26
[12.3, false],
27
['12.3', false],
28
['string', false],
29
[-1, false],
30
['-1', false],
31
[1, true],
32
[0, true],
33
[12345, true],
34
['12345', true],
35
['true', false],
36
['false', false],
37
['123_test', false],
38
['123.test', false],
39
['123test', false],
40
['test123', false],
41
['0x00000003', false],
42
[00000011, true],
43
['00000011', true],
44
['AD9C', false],
45
];
46
}
47
}
48
49