mirror of
https://github.com/SuiteCRM/SuiteCRM-Core.git
synced 2025-08-29 04:47:10 +08:00
Fix unit tests
- Update unit test bootstrap pathing - Move new theme images to new legacy path - Fix AccountsNewByMonthMock unit test warning - Change startLegacyApp to follow the correct method signature Signed-off-by: Dillon-Brown <dillon.brown@salesagility.com>
This commit is contained in:
parent
19884c2bb0
commit
06a6932496
4 changed files with 21 additions and 14 deletions
|
@ -35,7 +35,10 @@ class AccountsNewByMonthMock extends AccountsNewByMonth
|
|||
$this->bean = $bean;
|
||||
}
|
||||
|
||||
protected function startLegacyApp(): void
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function startLegacyApp(string $currentModule = ''): void
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ class Unit extends Module
|
|||
public function _beforeSuite($settings = []): void
|
||||
{
|
||||
self::$projectDir = codecept_root_dir();
|
||||
self::$legacyDir = self::$projectDir . '/legacy';
|
||||
self::$legacyDir = self::$projectDir . '/public/legacy';
|
||||
self::$legacySessionName = 'LEGACYSESSID';
|
||||
self::$defaultSessionName = 'PHPSESSID';
|
||||
self::$datetimeFormatMap = [
|
||||
|
|
|
@ -24,7 +24,7 @@ $kernel->init([
|
|||
// Bootstrap composer
|
||||
require_once __DIR__ . '/../../vendor/autoload.php';
|
||||
|
||||
chdir(__DIR__ . '/../../legacy');
|
||||
chdir(__DIR__ . '/../../public/legacy');
|
||||
|
||||
// Bootstrap SuiteCRM
|
||||
if (!defined('sugarEntry')) {
|
||||
|
@ -33,10 +33,10 @@ if (!defined('sugarEntry')) {
|
|||
}
|
||||
|
||||
// Load in legacy
|
||||
require_once __DIR__ . '/../../legacy/include/utils.php';
|
||||
require_once __DIR__ . '/../../legacy/include/modules.php';
|
||||
require_once __DIR__ . '/../../legacy/include/MVC/preDispatch.php';
|
||||
require_once __DIR__ . '/../../legacy/include/entryPoint.php';
|
||||
require_once __DIR__ . '/../../public/legacy/include/utils.php';
|
||||
require_once __DIR__ . '/../../public/legacy/include/modules.php';
|
||||
require_once __DIR__ . '/../../public/legacy/include/MVC/preDispatch.php';
|
||||
require_once __DIR__ . '/../../public/legacy/include/entryPoint.php';
|
||||
|
||||
$kernel->loadFile(__DIR__ . '/../_mock/Helpers/core/legacy/Data/DBQueryResultsMocking.php');
|
||||
$kernel->loadPhpFiles(__DIR__ . '/../_mock/Mock');
|
||||
|
|
|
@ -6,6 +6,7 @@ use App\Service\ThemeImageFinder;
|
|||
use App\Service\ThemeImageService;
|
||||
use App\Tests\UnitTester;
|
||||
use Codeception\Test\Unit;
|
||||
use Exception;
|
||||
use Symfony\Component\Finder\SplFileInfo;
|
||||
|
||||
/**
|
||||
|
@ -24,15 +25,18 @@ class ThemeImageServiceTest extends Unit
|
|||
*/
|
||||
protected $themeImageService;
|
||||
|
||||
/**
|
||||
* @throws Exception
|
||||
*/
|
||||
protected function _before(): void
|
||||
{
|
||||
$themeImagePaths = [
|
||||
'legacy/themes/default/images',
|
||||
'legacy/custom/themes/default/images',
|
||||
'core/app/themes/default/images',
|
||||
'dist/themes/default/images',
|
||||
'legacy/themes/<theme>/images',
|
||||
'legacy/custom/themes/<theme>/images',
|
||||
'core/app/themes/<theme>/images',
|
||||
'dist/themes/<theme>/images',
|
||||
];
|
||||
$themeImageSupportedTypes = [
|
||||
'svg',
|
||||
|
@ -43,7 +47,7 @@ class ThemeImageServiceTest extends Unit
|
|||
];
|
||||
|
||||
$mockImages = [
|
||||
'/legacy/themes/default/images' => [
|
||||
'/public/legacy/themes/default/images' => [
|
||||
new SplFileInfo('logo.png', 'legacy/themes/default/images', 'legacy/themes/default/images'),
|
||||
new SplFileInfo('legacy_image.png', 'legacy/themes/default/images', 'legacy/themes/default/images'),
|
||||
new SplFileInfo('to_be_overwritten.png', 'legacy/themes/default/images',
|
||||
|
@ -51,13 +55,13 @@ class ThemeImageServiceTest extends Unit
|
|||
new SplFileInfo('to_be_overwritten_with_different_extension.png', 'legacy/themes/default/images',
|
||||
'legacy/themes/default/images')
|
||||
],
|
||||
'/legacy/themes/suite8/images' => [
|
||||
'/public/legacy/themes/suite8/images' => [
|
||||
new SplFileInfo('to_be_overwritten.png', 'legacy/themes/suite8/images', 'legacy/themes/suite8/images'),
|
||||
new SplFileInfo('to_be_overwritten_with_different_extension.svg', 'legacy/themes/suite8/images',
|
||||
'legacy/themes/suite8/images')
|
||||
],
|
||||
'/core/app/themes/suite8/images' => [
|
||||
new SplFileInfo('logo.png', 'core/app/themes/suite8/images', 'core/app/themes/suite8/images'),
|
||||
'/public/dist/themes/suite8/images' => [
|
||||
new SplFileInfo('logo.png', 'dist/themes/suite8/images', 'dist/themes/suite8/images'),
|
||||
]
|
||||
];
|
||||
|
||||
|
@ -109,7 +113,7 @@ class ThemeImageServiceTest extends Unit
|
|||
{
|
||||
$expected = [
|
||||
'logo' => [
|
||||
'path' => 'core/app/themes/suite8/images/logo.png',
|
||||
'path' => 'dist/themes/suite8/images/logo.png',
|
||||
'name' => 'logo',
|
||||
'type' => 'png'
|
||||
],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue