mirror of
https://github.com/SuiteCRM/SuiteCRM-Core.git
synced 2025-09-07 10:36:27 +08:00
- Add UnitTester to hook into codeception login when executing tests. - Create _beforeSuite and _before methods to reduce code duplication and improve performance. - Add static closures where possible for better scoping and performance. - Fix missing typehints/PHPDocs. Signed-off-by: Dillon-Brown <dillon.brown@salesagility.com>
57 lines
1.4 KiB
PHP
57 lines
1.4 KiB
PHP
<?php namespace App\Tests;
|
|
|
|
use Codeception\Test\Unit;
|
|
use SuiteCRM\Core\Legacy\ModuleRegistryHandler;
|
|
|
|
class ModuleRegistryHandlerTest extends Unit
|
|
{
|
|
/**
|
|
* @var UnitTester
|
|
*/
|
|
protected $tester;
|
|
|
|
/**
|
|
* @var ModuleRegistryHandler
|
|
*/
|
|
protected $handler;
|
|
|
|
protected function _before(): void
|
|
{
|
|
$projectDir = $this->tester->getProjectDir();
|
|
$legacyDir = $this->tester->getLegacyDir();
|
|
$legacySessionName = $this->tester->getlegacySessionName();
|
|
$defaultSessionName = $this->tester->getdefaultSessionName();
|
|
$legacyScope = $this->tester->getLegacyScope();
|
|
|
|
$excludedModules = [
|
|
'EmailText',
|
|
'TeamMemberships',
|
|
'TeamSets',
|
|
'TeamSetModule'
|
|
];
|
|
|
|
$this->handler = new ModuleRegistryHandler(
|
|
$projectDir,
|
|
$legacyDir,
|
|
$legacySessionName,
|
|
$defaultSessionName,
|
|
$legacyScope,
|
|
$excludedModules
|
|
);
|
|
}
|
|
|
|
// tests
|
|
|
|
/**
|
|
* Test accessible modules retrieval
|
|
*/
|
|
public function testGetAccessibleModules(): void
|
|
{
|
|
|
|
$modules = $this->handler->getUserAccessibleModules();
|
|
|
|
static::assertContainsEquals('Accounts', $modules);
|
|
static::assertContainsEquals('Alert', $modules);
|
|
static::assertContainsEquals('EmailMan', $modules);
|
|
}
|
|
}
|