mirror of
https://github.com/FOSSBilling/FOSSBilling.git
synced 2026-11-09 21:43:22 +09:00
Apply suggested fix to tests/Modules/Theme/AdminTest.php from Copilot Autofix Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
42 lines
1.5 KiB
PHP
42 lines
1.5 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace ThemeTests;
|
|
|
|
use APIHelper\Request;
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
final class AdminTest extends TestCase
|
|
{
|
|
public function testGetCurrentClientTheme(): void
|
|
{
|
|
$result = Request::makeRequest('admin/theme/get_current');
|
|
$this->assertTrue($result->wasSuccessful(), $result->generatePHPUnitMessage());
|
|
$this->assertIsArray($result->getResult());
|
|
|
|
$this->assertArrayHasKey('name', $result->getResult());
|
|
$this->assertArrayHasKey('version', $result->getResult());
|
|
$this->assertArrayHasKey('author', $result->getResult());
|
|
$this->assertEquals('FOSSBilling', $result->getResult()['author']);
|
|
}
|
|
|
|
public function testGetCurrentAdminTheme(): void
|
|
{
|
|
$result = Request::makeRequest('admin/theme/get_current', ['client' => false]);
|
|
$this->assertTrue($result->wasSuccessful(), $result->generatePHPUnitMessage());
|
|
$this->assertIsArray($result->getResult());
|
|
|
|
$this->assertArrayHasKey('name', $result->getResult());
|
|
$this->assertArrayHasKey('version', $result->getResult());
|
|
$this->assertArrayHasKey('author', $result->getResult());
|
|
$this->assertEquals('FOSSBilling', $result->getResult()['author']);
|
|
}
|
|
|
|
public function testInvalidThemeActionReturnsError(): void
|
|
{
|
|
$result = Request::makeRequest('admin/theme/non_existing_action');
|
|
$this->assertFalse($result->wasSuccessful(), 'Invalid theme action should not be successful.');
|
|
}
|
|
}
|