Add some unit tests for Providers\ServerVariables classes
Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.net>
This commit is contained in:
parent
7a437e2da9
commit
2a9507b426
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Tests\Providers\ServerVariables;
|
||||
|
||||
use PhpMyAdmin\Providers\ServerVariables\ServerVariablesProvider;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use ReflectionProperty;
|
||||
|
||||
#[CoversClass(ServerVariablesProvider::class)]
|
||||
final class ServerVariablesProviderTest extends TestCase
|
||||
{
|
||||
public function testUniqueness(): void
|
||||
{
|
||||
(new ReflectionProperty(ServerVariablesProvider::class, 'instance'))->setValue(null, null);
|
||||
$instanceOne = ServerVariablesProvider::getImplementation();
|
||||
$instanceTwo = ServerVariablesProvider::getImplementation();
|
||||
self::assertSame($instanceOne, $instanceTwo);
|
||||
}
|
||||
}
|
||||
22
tests/unit/Providers/ServerVariables/VoidProviderTest.php
Normal file
22
tests/unit/Providers/ServerVariables/VoidProviderTest.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Tests\Providers\ServerVariables;
|
||||
|
||||
use PhpMyAdmin\Providers\ServerVariables\VoidProvider;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
#[CoversClass(VoidProvider::class)]
|
||||
final class VoidProviderTest extends TestCase
|
||||
{
|
||||
public function testVoidProvider(): void
|
||||
{
|
||||
$provider = new VoidProvider();
|
||||
self::assertNull($provider->getVariableType('test'));
|
||||
self::assertSame([], $provider->getStaticVariables());
|
||||
self::assertNull($provider->getDocLinkByNameMariaDb('test'));
|
||||
self::assertNull($provider->getDocLinkByNameMysql('test'));
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user