chore: initial import for test contour with k3s CI
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Tests\Unit\Support;
|
||||
|
||||
use App\Support\OnlineMode;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class OnlineModeTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @dataProvider onlineValuesProvider
|
||||
*/
|
||||
public function testIsOnline(mixed $input, bool $expected): void
|
||||
{
|
||||
$this->assertSame($expected, OnlineMode::isOnline($input));
|
||||
$this->assertSame($expected ? 1 : 0, OnlineMode::toInt($input));
|
||||
}
|
||||
|
||||
public function onlineValuesProvider(): array
|
||||
{
|
||||
return [
|
||||
'int 1' => [1, true],
|
||||
'int 0' => [0, false],
|
||||
'string 1' => ['1', true],
|
||||
'string 0' => ['0', false],
|
||||
'true bool' => [true, true],
|
||||
'false bool' => [false, false],
|
||||
'true string' => ['true', true],
|
||||
'false string' => ['false', false],
|
||||
'yes' => ['yes', true],
|
||||
'empty' => ['', false],
|
||||
'null' => [null, false],
|
||||
'garbage' => ['maybe', false],
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user