mirror of
https://github.com/FOSSBilling/FOSSBilling.git
synced 2026-11-09 05:24:58 +09:00
* Initial plan * Refactor test helpers: extract named doubles, fix mock inconsistencies, add return types and negative test cases Agent-Logs-Url: https://github.com/FOSSBilling/FOSSBilling/sessions/e732bafd-6bd7-40c6-b976-f13240612867 Co-authored-by: admdly <2807620+admdly@users.noreply.github.com> * Fix CI failures: use named class instead of addMethods(), fix checkInvoiceAuth assertion Agent-Logs-Url: https://github.com/FOSSBilling/FOSSBilling/sessions/c519e2d3-203c-4eba-962a-547a5f1ddfe0 Co-authored-by: admdly <2807620+admdly@users.noreply.github.com> * Fix testTryTokenLoginRejectsCronAdminToken: give dbAdmin and cronAdmin the same ID so the ID-match check throws the expected exception Agent-Logs-Url: https://github.com/FOSSBilling/FOSSBilling/sessions/ae7acf19-c6bf-43c4-abaf-d50a321d69b3 Co-authored-by: admdly <2807620+admdly@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: admdly <2807620+admdly@users.noreply.github.com>
40 lines
1.3 KiB
PHP
40 lines
1.3 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace ExtensionTests;
|
|
|
|
use APIHelper\Request;
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
final class GuestTest extends TestCase
|
|
{
|
|
public function testSettings(): void
|
|
{
|
|
$result = Request::makeRequest('guest/extension/settings', ['ext' => 'index']);
|
|
$this->assertTrue($result->wasSuccessful(), $result->generatePHPUnitMessage());
|
|
$this->assertIsArray($result->getResult());
|
|
}
|
|
|
|
public function testSettingsMissingExt(): void
|
|
{
|
|
$result = Request::makeRequest('guest/extension/settings', ['ext' => '']);
|
|
$this->assertFalse($result->wasSuccessful(), $result->generatePHPUnitMessage());
|
|
$this->assertEquals('Parameter ext is missing', $result->getErrorMessage());
|
|
}
|
|
|
|
public function testExtensionIsActive(): void
|
|
{
|
|
$result = Request::makeRequest('guest/extension/is_on', ['mod' => 'index']);
|
|
$this->assertTrue($result->wasSuccessful(), $result->generatePHPUnitMessage());
|
|
$this->assertTrue($result->getResult());
|
|
}
|
|
|
|
public function testExtensionIsNotActive(): void
|
|
{
|
|
$result = Request::makeRequest('guest/extension/is_on', ['mod' => 'serviceapikey']);
|
|
$this->assertTrue($result->wasSuccessful(), $result->generatePHPUnitMessage());
|
|
$this->assertFalse($result->getResult());
|
|
}
|
|
}
|