Files
FOSSBilling/tests/Modules/Extension/GuestTest.php
T
Yağızhan Burak YakarandAdam Daley 091bd5c67b Refactor guest API routes and reduce the information passed (#3474)
* Remove guest API system version endpoint

* Moved theme information to Admin API

* Removed references to the old "comment" module

* Remove unused cron endpoints

* Don't pass registrar information to guests

* Filter out Product toApiArray properties

* Redact public ticket information passed via the guest API

* Move redaction logic to the serializer

* Moved honeypot information to a Twig function

* More redaction

* Fixed tests

* Block additional paths

* Reduce the amount of information passed to clients

* Mask file downloads behind sendFile rather than serializing original path

* Move honeypot information to the new Twig function

* Add missing curly bracket

* Removed unused `get_slider` endpoint

* Turn publicMessageToApiArray into an allowlist

---------

Co-authored-by: Adam Daley <admdly@users.noreply.github.com>
2026-05-04 21:48:11 +01:00

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());
}
}