phpmyadmin/tests/unit/Server/SysInfo/SysInfoTest.php
Maurício Meneghini Fauth 606f66b5df
Rename tests/classes to tests/unit
This directory is for unit tests only, so let's rename it to unit to be
more clear.

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2024-02-23 13:29:07 -03:00

57 lines
1.3 KiB
PHP

<?php
declare(strict_types=1);
namespace PhpMyAdmin\Tests\Server\SysInfo;
use PhpMyAdmin\Server\SysInfo\Base;
use PhpMyAdmin\Server\SysInfo\SysInfo;
use PhpMyAdmin\Tests\AbstractTestCase;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\DataProvider;
#[CoversClass(SysInfo::class)]
class SysInfoTest extends AbstractTestCase
{
/**
* Test for OS detection
*
* @param string $os OS name as returned by PHP_OS
* @param string $expected Expected detected OS name
*/
#[DataProvider('sysInfoOsProvider')]
public function testGetSysInfoOs(string $os, string $expected): void
{
self::assertSame(
$expected,
SysInfo::getOs($os),
);
}
/**
* Data provider for OS detection tests.
*
* @return string[][]
*/
public static function sysInfoOsProvider(): array
{
return [['FreeBSD', 'Linux'], ['Linux', 'Linux'], ['Winnt', 'Winnt'], ['SunOS', 'SunOS']];
}
/**
* Test for getting sysinfo object.
*/
public function testGetSysInfo(): void
{
self::assertInstanceOf(Base::class, SysInfo::get());
}
/**
* Test for getting supported sysinfo object.
*/
public function testGetSysInfoSupported(): void
{
self::assertTrue(SysInfo::get()::isSupported());
}
}