mirror of
https://github.com/SuiteCRM/SuiteCRM-Core.git
synced 2025-08-29 11:00:40 +08:00
Fix editview metadata loading for Users module
- Properly load the legacy app and router -- Fixes user module metadata loading - Adjust unit tests
This commit is contained in:
parent
544adba1b3
commit
bfed5ae78e
23 changed files with 112 additions and 33 deletions
|
@ -165,6 +165,7 @@ abstract class LegacyHandler
|
|||
|
||||
/**
|
||||
* Start Legacy Suite app
|
||||
* @param string $currentModule
|
||||
* @return void
|
||||
* Based on @see SugarApplication::execute
|
||||
* Not calling:
|
||||
|
@ -174,7 +175,7 @@ abstract class LegacyHandler
|
|||
* - controller->execute();
|
||||
* - sugar_cleanup
|
||||
*/
|
||||
protected function startLegacyApp(): void
|
||||
protected function startLegacyApp(string $currentModule = ''): void
|
||||
{
|
||||
if ($this->state->isLegacyStarted()) {
|
||||
return;
|
||||
|
@ -194,8 +195,8 @@ abstract class LegacyHandler
|
|||
}
|
||||
|
||||
$module = $app->default_module;
|
||||
if (!empty($_REQUEST['module'])) {
|
||||
$module = $_REQUEST['module'];
|
||||
if (!empty($currentModule)) {
|
||||
$module = $currentModule;
|
||||
}
|
||||
|
||||
/** @var SugarController $controller */
|
||||
|
|
|
@ -141,6 +141,8 @@ class ViewDefinitionsHandler extends LegacyHandler implements ViewDefinitionsPro
|
|||
|
||||
$legacyModuleName = $this->validateModuleName($moduleName);
|
||||
|
||||
$this->startLegacyApp($legacyModuleName);
|
||||
|
||||
$viewDef = new ViewDefinition();
|
||||
$viewDef->setId($moduleName);
|
||||
|
||||
|
|
|
@ -20,7 +20,10 @@ class AssignedUserOpportunitiesCountMock extends AssignedUserOpportunitiesCount
|
|||
return $this->getMockQueryResults();
|
||||
}
|
||||
|
||||
protected function startLegacyApp(): void
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function startLegacyApp(string $currentModule = ''): void
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
|
||||
namespace App\Tests\_mock\Mock\core\legacy\Statistics;
|
||||
|
||||
use App\Legacy\Statistics\CaseDaysOpen;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use aCase;
|
||||
use App\Legacy\Statistics\CaseDaysOpen;
|
||||
use App\Tests\_mock\Helpers\core\legacy\Data\DBQueryResultsMocking;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use SugarBean;
|
||||
|
||||
/**
|
||||
|
@ -38,7 +38,10 @@ class CaseDaysOpenMock extends CaseDaysOpen
|
|||
return $this->case;
|
||||
}
|
||||
|
||||
protected function startLegacyApp(): void
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function startLegacyApp(string $currentModule = ''): void
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -2,11 +2,9 @@
|
|||
|
||||
namespace Mock\Core\Legacy\Statistics;
|
||||
|
||||
use AcceptanceTester;
|
||||
use aCase;
|
||||
use App\Legacy\Statistics\CasesPerAccount;
|
||||
use App\Tests\_mock\Helpers\core\legacy\Data\DBQueryResultsMocking;
|
||||
use SugarBean;
|
||||
use aCase;
|
||||
use BeanFactory;
|
||||
|
||||
class CasesPerAccountMock extends CasesPerAccount
|
||||
|
@ -34,7 +32,10 @@ class CasesPerAccountMock extends CasesPerAccount
|
|||
return $this->getMockQueryResults();
|
||||
}
|
||||
|
||||
protected function startLegacyApp(): void
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function startLegacyApp(string $currentModule = ''): void
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
namespace App\Tests\_mock\Mock\core\legacy\Statistics;
|
||||
|
||||
use App\Legacy\Statistics\DaysUntilDueTask;
|
||||
use Task;
|
||||
use App\Tests\_mock\Helpers\core\legacy\Data\DBQueryResultsMocking;
|
||||
use Task;
|
||||
|
||||
/**
|
||||
* Class DaysUntilDueTaskMock
|
||||
|
@ -36,7 +36,10 @@ class DaysUntilDueTaskMock extends DaysUntilDueTask
|
|||
return $this->task;
|
||||
}
|
||||
|
||||
protected function startLegacyApp(): void
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function startLegacyApp(string $currentModule = ''): void
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
namespace App\Tests\_mock\Mock\core\legacy\Statistics;
|
||||
|
||||
use App\Legacy\Statistics\LeadDaysOpen;
|
||||
use App\Tests\_mock\Helpers\core\legacy\Data\DBQueryResultsMocking;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Lead;
|
||||
use App\Tests\_mock\Helpers\core\legacy\Data\DBQueryResultsMocking;
|
||||
use SugarBean;
|
||||
|
||||
/**
|
||||
|
@ -38,7 +38,10 @@ class LeadDaysOpenMock extends LeadDaysOpen
|
|||
return $this->lead;
|
||||
}
|
||||
|
||||
protected function startLegacyApp(): void
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function startLegacyApp(string $currentModule = ''): void
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
namespace App\Tests\_mock\Mock\core\legacy\Statistics;
|
||||
|
||||
use App\Legacy\Statistics\OpportunitySalesStageTimeSpan;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use App\Tests\_mock\Helpers\core\legacy\Data\DBQueryResultsMocking;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Opportunity;
|
||||
use SugarBean;
|
||||
|
||||
|
@ -38,7 +38,10 @@ class OpportunitySalesStageTimeSpanMock extends OpportunitySalesStageTimeSpan
|
|||
return $this->opp;
|
||||
}
|
||||
|
||||
protected function startLegacyApp(): void
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function startLegacyApp(string $currentModule = ''): void
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,10 @@ class OpportunitySizeAnalysisMock extends OpportunitySizeAnalysis
|
|||
return $this->getMockQueryResults();
|
||||
}
|
||||
|
||||
protected function startLegacyApp(): void
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function startLegacyApp(string $currentModule = ''): void
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,10 @@ class LeadsByStatusCountMock extends LeadsByStatusCount
|
|||
$this->bean = $bean;
|
||||
}
|
||||
|
||||
protected function startLegacyApp(): void
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function startLegacyApp(string $currentModule = ''): void
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,10 @@ class OpportunitiesBySalesStagePipelineMock extends OpportunitiesBySalesStagePip
|
|||
$this->bean = $bean;
|
||||
}
|
||||
|
||||
protected function startLegacyApp(): void
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function startLegacyApp(string $currentModule = ''): void
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -47,6 +50,9 @@ class OpportunitiesBySalesStagePipelineMock extends OpportunitiesBySalesStagePip
|
|||
return $this->getAllMockQueryResults();
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function generateQuery(array $query): array
|
||||
{
|
||||
return [
|
||||
|
|
|
@ -35,7 +35,10 @@ class SubPanelActivitiesNextDateMock extends SubPanelActivitiesNextDate
|
|||
return $this->getMockQueryResults();
|
||||
}
|
||||
|
||||
protected function startLegacyApp(): void
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function startLegacyApp(string $currentModule = ''): void
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,7 +35,10 @@ class SubPanelCampaignLastReceivedMock extends SubPanelCampaignsLastReceived
|
|||
return $this->getMockQueryResults();
|
||||
}
|
||||
|
||||
protected function startLegacyApp(): void
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function startLegacyApp(string $currentModule = ''): void
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,7 +34,10 @@ class SubPanelCasesCountMock extends SubPanelCasesCount
|
|||
return $this->getMockQueryResults();
|
||||
}
|
||||
|
||||
protected function startLegacyApp(): void
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function startLegacyApp(string $currentModule = ''): void
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,7 +36,10 @@ class SubPanelContractsRenewalDateMock extends SubPanelContractsRenewalDate
|
|||
return $this->getMockQueryResults();
|
||||
}
|
||||
|
||||
protected function startLegacyApp(): void
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function startLegacyApp(string $currentModule = ''): void
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,7 +35,10 @@ class SubPanelEventsLastDateMock extends SubPanelEventsLastDate
|
|||
return $this->getMockQueryResults();
|
||||
}
|
||||
|
||||
protected function startLegacyApp(): void
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function startLegacyApp(string $currentModule = ''): void
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,7 +40,10 @@ class SubPanelHistoryLastDateMock extends SubPanelHistoryLastDate
|
|||
return $this->getMockQueryResults();
|
||||
}
|
||||
|
||||
protected function startLegacyApp(): void
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function startLegacyApp(string $currentModule = ''): void
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,7 +34,10 @@ class SubPanelInvoicesTotalMock extends SubPanelInvoicesTotal
|
|||
return $this->getMockQueryResults();
|
||||
}
|
||||
|
||||
protected function startLegacyApp(): void
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function startLegacyApp(string $currentModule = ''): void
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,7 +36,10 @@ class SubPanelQuotesTotalMock extends SubPanelQuotesTotal
|
|||
return $this->getMockQueryResults();
|
||||
}
|
||||
|
||||
protected function startLegacyApp(): void
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function startLegacyApp(string $currentModule = ''): void
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,7 +34,10 @@ class SubpanelOpportunitiesTotalMock extends SubpanelOpportunitiesTotal
|
|||
return $this->getMockQueryResults();
|
||||
}
|
||||
|
||||
protected function startLegacyApp(): void
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function startLegacyApp(string $currentModule = ''): void
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,7 +34,10 @@ class WonOpportunityAmountByYearMock extends WonOpportunityAmountByYear
|
|||
return $this->getMockQueryResults();
|
||||
}
|
||||
|
||||
protected function startLegacyApp(): void
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function startLegacyApp(string $currentModule = ''): void
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
18
tests/_mock/Mock/core/legacy/ViewDefinitionsHandlerMock.php
Normal file
18
tests/_mock/Mock/core/legacy/ViewDefinitionsHandlerMock.php
Normal file
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
|
||||
|
||||
namespace App\Tests\_mock\Mock\core\legacy;
|
||||
|
||||
|
||||
use App\Legacy\ViewDefinitionsHandler;
|
||||
|
||||
class ViewDefinitionsHandlerMock extends ViewDefinitionsHandler
|
||||
{
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function startLegacyApp(string $currentModule = ''): void
|
||||
{
|
||||
}
|
||||
}
|
|
@ -9,7 +9,6 @@ use App\Legacy\ModuleNameMapperHandler;
|
|||
use App\Legacy\ViewDefinitions\ListViewDefinitionHandler;
|
||||
use App\Legacy\ViewDefinitions\RecordViewDefinitionHandler;
|
||||
use App\Legacy\ViewDefinitions\SubPanelDefinitionHandler;
|
||||
use App\Legacy\ViewDefinitionsHandler;
|
||||
use App\Service\AclManagerInterface;
|
||||
use App\Service\BulkActionDefinitionProvider;
|
||||
use App\Service\FilterDefinitionProvider;
|
||||
|
@ -17,6 +16,7 @@ use App\Service\FilterDefinitionProviderInterface;
|
|||
use App\Service\LineActionDefinitionProvider;
|
||||
use App\Service\ListViewSidebarWidgetDefinitionProvider;
|
||||
use App\Service\RecordActionDefinitionProvider;
|
||||
use App\Tests\_mock\Mock\core\legacy\ViewDefinitionsHandlerMock;
|
||||
use App\Tests\UnitTester;
|
||||
use Codeception\Test\Unit;
|
||||
use Exception;
|
||||
|
@ -35,7 +35,7 @@ final class ViewDefinitionsHandlerTest extends Unit
|
|||
protected $tester;
|
||||
|
||||
/**
|
||||
* @var ViewDefinitionsHandler
|
||||
* @var ViewDefinitionsHandlerMock
|
||||
*/
|
||||
private $viewDefinitionHandler;
|
||||
|
||||
|
@ -270,7 +270,7 @@ final class ViewDefinitionsHandlerTest extends Unit
|
|||
$filterDefinitionHandler
|
||||
);
|
||||
|
||||
$this->viewDefinitionHandler = new ViewDefinitionsHandler(
|
||||
$this->viewDefinitionHandler = new ViewDefinitionsHandlerMock(
|
||||
$projectDir,
|
||||
$legacyDir,
|
||||
$legacySessionName,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue