mirror of
https://github.com/FOSSBilling/FOSSBilling.git
synced 2026-12-05 06:35:38 +09:00
* Sanitize invoice hash and secure asset paths * Guard against missing client session * Serialize invoice items into indexed inputs * Validate URL field input type before checking * Block legacy paid support hooks on ticket create * Harden CSRF token validation in API client * Add 'Paidsupport' to cspell word list * Use Stripe metadata to link client and invoice * Remove legacy Paidsupport hooks handling * Add paidsupport to cspell word list * Use config debug flag; always warn if install exists * Revert "Use config debug flag; always warn if install exists" This reverts commit fda6fcc0b05758d897a837d125ce1c0a35be0226. * Fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * Fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * Fix Stripe getClientFromTransaction and simplify UpdatePatcher cache invalidation Agent-Logs-Url: https://github.com/FOSSBilling/FOSSBilling/sessions/49a72bff-61f2-4a3e-9107-08aec7b255d2 Co-authored-by: admdly <2807620+admdly@users.noreply.github.com> * Fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * Restrict Dompdf logo remote URLs to http/https schemes only Agent-Logs-Url: https://github.com/FOSSBilling/FOSSBilling/sessions/58c16027-cc36-4c11-a039-0bfcaf5a45f5 Co-authored-by: admdly <2807620+admdly@users.noreply.github.com> * Enable Buildx cache and add release archive * Restrict `claimForProcessing` SQL and update tests * Add HTML sanitizer and sandboxed Twig rendering * Update test expected HTML in ServiceTest * Add `RequestFactory` and trusted proxy support * Use HttpFoundation Responses & Request everywhere * Return HTTP Response objects for exports/downloads * Refactor request routing, auth errors and CSV export * Remove RequestFactory wrapper and minor cleanups * Specify Response union return types * Parenthesize response constructions before send * Clean up PHPStan ignore rules * Relax HTML test to accept optional tbody/br * fix(theme): call getUploadedAssets without arguments Agent-Logs-Url: https://github.com/FOSSBilling/FOSSBilling/sessions/ce04bff6-ccde-4a10-8a68-f6278b1b550e Co-authored-by: admdly <2807620+admdly@users.noreply.github.com> --------- Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@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>
94 lines
3.0 KiB
PHP
94 lines
3.0 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Box\Mod\Theme\Controller;
|
|
|
|
use PHPUnit\Framework\Attributes\Group;
|
|
|
|
#[Group('Core')]
|
|
final class AdminTest extends \BBTestCase
|
|
{
|
|
public function testDi(): void
|
|
{
|
|
$controller = new Admin();
|
|
|
|
$di = $this->getDi();
|
|
$db = $this->createMock('Box_Database');
|
|
|
|
$di['db'] = $db;
|
|
$controller->setDi($di);
|
|
$result = $controller->getDi();
|
|
$this->assertEquals($di, $result);
|
|
}
|
|
|
|
public function testRegister(): void
|
|
{
|
|
$boxAppMock = $this->getMockBuilder('\Box_App')->disableOriginalConstructor()->getMock();
|
|
$boxAppMock->expects($this->exactly(1))
|
|
->method('get');
|
|
|
|
$controller = new Admin();
|
|
$controller->register($boxAppMock);
|
|
}
|
|
|
|
public function testGetTheme(): void
|
|
{
|
|
$boxAppMock = $this->getMockBuilder('\Box_App')->disableOriginalConstructor()->getMock();
|
|
$boxAppMock->expects($this->atLeastOnce())
|
|
->method('render')
|
|
->with(
|
|
'mod_theme_preset',
|
|
$this->callback(function (array $data): bool {
|
|
$this->assertInstanceOf(\Twig\Markup::class, $data['settings_html']);
|
|
|
|
return true;
|
|
})
|
|
)
|
|
->willReturn('Rendering ...');
|
|
|
|
$themeMock = $this->getMockBuilder(\Box\Mod\Theme\Model\Theme::class)->disableOriginalConstructor()->getMock();
|
|
$themeMock->expects($this->atLeastOnce())
|
|
->method('getName');
|
|
$themeMock->expects($this->atLeastOnce())
|
|
->method('getUploadedAssets');
|
|
$themeMock->expects($this->atLeastOnce())
|
|
->method('isAssetsPathWritable')
|
|
->willReturn(false);
|
|
|
|
$themeServiceMock = $this->createMock(\Box\Mod\Theme\Service::class);
|
|
$themeServiceMock->expects($this->atLeastOnce())
|
|
->method('getTheme')
|
|
->willReturn($themeMock);
|
|
$themeServiceMock->expects($this->atLeastOnce())
|
|
->method('getCurrentThemePreset')
|
|
->willReturn('default');
|
|
$themeServiceMock->expects($this->atLeastOnce())
|
|
->method('renderThemeSettingsPageHtml')
|
|
->willReturn('');
|
|
$themeServiceMock->expects($this->atLeastOnce())
|
|
->method('getThemeSettings')
|
|
->willReturn([]);
|
|
$themeServiceMock->expects($this->atLeastOnce())
|
|
->method('getThemePresets');
|
|
|
|
$modMock = $this->getMockBuilder('\\' . \FOSSBilling\Module::class)->disableOriginalConstructor()->getMock();
|
|
$modMock->expects($this->atLeastOnce())
|
|
->method('getService')
|
|
->willReturn($themeServiceMock);
|
|
|
|
$di = $this->getDi();
|
|
$di['mod'] = $di->protect(function ($name) use ($modMock) {
|
|
if ($name == 'theme') {
|
|
return $modMock;
|
|
}
|
|
});
|
|
|
|
$di['is_admin_logged'] = true;
|
|
|
|
$controller = new Admin();
|
|
$controller->setDi($di);
|
|
$controller->get_theme($boxAppMock, 'huraga');
|
|
}
|
|
}
|