EspoCRM – Open Source CRM Application
PHP calendarcontactscrmcrm-platformcrm-systemcustomer-portalcustomer-supportcustomizabledocumentsemail-marketingkanbanleadsopen-sourcephpplatformsales-automationsingle-page-applicationsupport
Add test
Yuriic04a22c122ce
diff --git a/tests/integration/Espo/User/AccessTest.php b/tests/integration/Espo/User/AccessTest.phpindex 40df24960d..4bb13a0da3 100644--- a/tests/integration/Espo/User/AccessTest.php+++ b/tests/integration/Espo/User/AccessTest.php@@ -29,7 +29,10 @@namespace tests\integration\Espo\User;+use Espo\Core\Container;use Espo\Core\Exceptions\Forbidden;+use Espo\Core\Formula\Exceptions\NotAllowedUsage;+use Espo\Core\Formula\Manager as FormulaManager;use Espo\Core\Record\ServiceContainer;use Espo\Entities\User;use tests\integration\Core\BaseTestCase;@@ -94,5 +97,30 @@ class AccessTest extends BaseTestCase}$this->assertTrue($thrown);++ //++ $fm = $this->getContainer()->getByClass(FormulaManager::class);++ $script = <<<'EOT'+ $data = object\create();+ $data['type'] = 'super-admin';++ record\update('User', '{{id}}', $data);+ EOT;++ $thrown = false;++ try {+ $script = strtr($script, [+ '{{id}}' => $userRegular->getId(),+ ]);++ $fm->run($script);+ } catch (NotAllowedUsage) {+ $thrown = true;+ }++ $this->assertTrue($thrown);}}