Harden support ticket loader toggle and align Client Admin test mocks/naming (#3603)

* Initial plan

* fix: apply null guard and AdminTest consistency updates

Agent-Logs-Url: https://github.com/FOSSBilling/FOSSBilling/sessions/17c37e88-7f83-4900-97b8-8a3fd314c492

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>
Co-authored-by: Adam Daley <admdly@users.noreply.github.com>
This commit is contained in:
authored and GitHub committed 2026-05-24 01:51:07 +01:00
1 parent ee444c8957
commit b90728e4e6
2 files changed
+18 -18

No files matched your search

@@ -216,6 +216,9 @@
const toggleLoader = () => {
let loader = document.querySelector('.wait');
if (!loader) {
return;
}
if (loader.style.display === 'none') {
loader.style.display = 'block';
} else {
+15 -18
View File
@@ -448,7 +448,7 @@ final class AdminTest extends \BBTestCase
$serviceMock = $this->createMock(\Box\Mod\Client\Service::class);
$serviceMock->expects($this->atLeastOnce())->method('emailAlreadyRegistered')->willReturn(true);
$serviceMock->expects($this->never())->method('canChangeCurrency')->willReturn(true);
$serviceMock->expects($this->never())->method('canChangeCurrency');
$staffServiceMock = $this->createMock(\Box\Mod\Staff\Service::class);
$staffServiceMock->expects($this->once())
@@ -643,12 +643,9 @@ final class AdminTest extends \BBTestCase
->willThrowException(new \FOSSBilling\InformationException('denied'));
$di = $this->getDi();
$di['mod_service'] = $di->protect(function ($serviceName) use ($staffServiceMock) {
if ($serviceName == 'Staff') {
return $staffServiceMock;
}
return false;
$di['mod_service'] = $di->protect(fn ($serviceName) => match (strtolower((string) $serviceName)) {
'staff' => $staffServiceMock,
default => false,
});
$adminClient = new \Box\Mod\Client\Api\Admin();
@@ -751,11 +748,11 @@ final class AdminTest extends \BBTestCase
'staff' => $staffServiceMock,
});
$admin_Client = new \Box\Mod\Client\Api\Admin();
$admin_Client->setDi($di);
$admin_Client->setService($serviceMock);
$adminClient = new \Box\Mod\Client\Api\Admin();
$adminClient->setDi($di);
$adminClient->setService($serviceMock);
$result = $admin_Client->export_csv([]);
$result = $adminClient->export_csv([]);
$this->assertInstanceOf(Response::class, $result);
$this->assertSame('csv-data', $result->getContent());
}
@@ -840,10 +837,10 @@ final class AdminTest extends \BBTestCase
$di = $this->getDi();
$di['mod_service'] = $di->protect(fn ($name): \PHPUnit\Framework\MockObject\MockObject => $serviceMock);
$admin_Client = new \Box\Mod\Client\Api\Admin();
$admin_Client->setDi($di);
$adminClient = new \Box\Mod\Client\Api\Admin();
$adminClient->setDi($di);
$result = $admin_Client->get_statuses([]);
$result = $adminClient->get_statuses([]);
$this->assertIsArray($result);
}
@@ -995,8 +992,8 @@ final class AdminTest extends \BBTestCase
public function testBatchDelete(): void
{
$activityMock = $this->getMockBuilder(\Box\Mod\Client\Api\Admin::class)->onlyMethods(['delete'])->getMock();
$activityMock->expects($this->atLeastOnce())->method('delete')->willReturn(true);
$adminClientMock = $this->getMockBuilder(\Box\Mod\Client\Api\Admin::class)->onlyMethods(['delete'])->getMock();
$adminClientMock->expects($this->atLeastOnce())->method('delete')->willReturn(true);
$staffServiceMock = $this->createMock(\Box\Mod\Staff\Service::class);
$staffServiceMock->expects($this->once())
@@ -1008,9 +1005,9 @@ final class AdminTest extends \BBTestCase
$di['mod_service'] = $di->protect(fn ($name): \PHPUnit\Framework\MockObject\MockObject => match (strtolower((string) $name)) {
'staff' => $staffServiceMock,
});
$activityMock->setDi($di);
$adminClientMock->setDi($di);
$result = $activityMock->batch_delete(['ids' => [1, 2, 3]]);
$result = $adminClientMock->batch_delete(['ids' => [1, 2, 3]]);
$this->assertTrue($result);
}
}