mirror of
https://github.com/FOSSBilling/FOSSBilling.git
synced 2026-12-01 04:40:45 +09:00
* Prevent non numeric values being used in limits Potential abuse for Sql injection Only allow integers to be used Adjust exception * Disable upload assets via Theme pages File upload was removed in an earlier PR * Make sure the test run fine * Fix the tests * Use limit instead of per_page * And another fix --------- Co-authored-by: Belle Aerni <belleaerni@gmail.com>
95 lines
2.8 KiB
PHP
95 lines
2.8 KiB
PHP
<?php
|
|
/**
|
|
* @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 = array();
|
|
|
|
$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($this->di['config']['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', $result);
|
|
$this->assertEquals('huraga', $result->getName());
|
|
}
|
|
}
|