mirror of
https://github.com/FOSSBilling/FOSSBilling.git
synced 2026-12-02 05:08:06 +09:00
* Wrote a few more tests, improvements * Ran Rector & PHP-CS-Fixer * Append a capital letter to the test client passwords * Minor tweaks * Display more info after the tests run * Oops, I forgot to set the dir * Fix cron behavior for test env, dropped legacy tests * Rename the empty test suite so PHPUnit ignores it * Update cspell.json * Minor tweaks to the tests * Fixes
93 lines
2.8 KiB
PHP
93 lines
2.8 KiB
PHP
<?php
|
|
|
|
#[PHPUnit\Framework\Attributes\Group('Core')]
|
|
class Box_Mod_Theme_ServiceTest extends BBDbApiTestCase
|
|
{
|
|
public function testgetCurrentThemePreset()
|
|
{
|
|
$service = new Box\Mod\Theme\Service();
|
|
$service->setDi($this->di);
|
|
$themeModel = $service->getTheme('huraga');
|
|
$result = $service->getCurrentThemePreset($themeModel);
|
|
$this->assertIsString($result);
|
|
$this->assertNotEmpty($result);
|
|
}
|
|
|
|
public function testgetThemePresets()
|
|
{
|
|
$service = new Box\Mod\Theme\Service();
|
|
$service->setDi($this->di);
|
|
$themeModel = $service->getTheme('huraga');
|
|
$result = $service->getThemePresets($themeModel);
|
|
$this->assertIsArray($result);
|
|
$this->assertNotEmpty($result);
|
|
}
|
|
|
|
public function testgetThemeSettings()
|
|
{
|
|
$service = new Box\Mod\Theme\Service();
|
|
$service->setDi($this->di);
|
|
$themeModel = $service->getTheme('huraga');
|
|
$result = $service->getThemeSettings($themeModel);
|
|
$this->assertIsArray($result);
|
|
}
|
|
|
|
public function testupdateSettings()
|
|
{
|
|
$service = new Box\Mod\Theme\Service();
|
|
$service->setDi($this->di);
|
|
|
|
$themeModel = $service->getTheme('huraga');
|
|
|
|
$preset = 'phpUnit';
|
|
$params = [];
|
|
|
|
$result = $service->updateSettings($themeModel, $preset, $params);
|
|
$this->assertTrue($result);
|
|
}
|
|
|
|
public function testregenerateThemeSettingsDataFile()
|
|
{
|
|
$service = new Box\Mod\Theme\Service();
|
|
$service->setDi($this->di);
|
|
|
|
$themeModel = $service->getTheme('huraga');
|
|
|
|
$result = $service->regenerateThemeSettingsDataFile($themeModel);
|
|
$this->assertTrue($result);
|
|
}
|
|
|
|
public function testregenerateThemeCssAndJsFiles()
|
|
{
|
|
$service = new Box\Mod\Theme\Service();
|
|
$service->setDi($this->di);
|
|
|
|
$themeModel = $service->getTheme('huraga');
|
|
|
|
$preset = 'phpUnit';
|
|
$result = $service->regenerateThemeCssAndJsFiles($themeModel, $preset, $this->di['api_admin']);
|
|
$this->assertTrue($result);
|
|
}
|
|
|
|
public function testgetCurrentAdminAreaTheme()
|
|
{
|
|
$service = new Box\Mod\Theme\Service();
|
|
$service->setDi($this->di);
|
|
|
|
$result = $service->getCurrentAdminAreaTheme();
|
|
$this->assertIsArray($result);
|
|
$this->assertEquals('admin_default', $result['code']);
|
|
$this->assertEquals(SYSTEM_URL . 'themes/admin_default/', $result['url']);
|
|
}
|
|
|
|
public function testgetCurrentClientAreaTheme()
|
|
{
|
|
$service = new Box\Mod\Theme\Service();
|
|
$service->setDi($this->di);
|
|
|
|
$result = $service->getCurrentClientAreaTheme();
|
|
$this->assertInstanceOf('\\' . Box\Mod\Theme\Model\Theme::class, $result);
|
|
$this->assertEquals('huraga', $result->getName());
|
|
}
|
|
}
|