The class AutoAssign has a coupling between objects value of 15. Consider to reduce the number of dependencies under 13. Open
class AutoAssign extends \Tests\Base
{
/**
* List of users.
*
- Read upRead up
- Exclude checks
CouplingBetweenObjects
Since: 1.1.0
A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability
Example
class Foo {
/**
* @var \foo\bar\X
*/
private $x = null;
/**
* @var \foo\bar\Y
*/
private $y = null;
/**
* @var \foo\bar\Z
*/
private $z = null;
public function setFoo(\Foo $foo) {}
public function setBar(\Bar $bar) {}
public function setBaz(\Baz $baz) {}
/**
* @return \SplObjectStorage
* @throws \OutOfRangeException
* @throws \InvalidArgumentException
* @throws \ErrorException
*/
public function process(\Iterator $it) {}
// ...
}
Source https://phpmd.org/rules/design.html#couplingbetweenobjects
Missing class import via use statement (line '213', column '20'). Open
$isChange = (new \App\Db\Query())
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '176', column '20'). Open
$handlers = (new \App\EventHandler())->setModuleName('HelpDesk')->getHandlers('EntityBeforeSave');
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '152', column '18'). Open
$request = new \App\Request([
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '259', column '20'). Open
$handlers = (new \App\EventHandler())->setModuleName('HelpDesk')->getHandlers('EntityBeforeSave');
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Avoid using static access to class '\Settings_Groups_Record_Model' in method 'setUpBeforeClass'. Open
$recordModel = \Settings_Groups_Record_Model::getCleanInstance();
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\User' in method 'setUpBeforeClass'. Open
\App\User::setCurrentUserId(\App\User::getActiveAdminId());
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\Users_Record_Model' in method 'tearDownAfterClass'. Open
\Users_Record_Model::deleteUserPermanently(self::$defaultUser->getId(), \App\User::getCurrentUserId());
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Module' in method 'testCreate'. Open
'tabid' => \App\Module::getModuleId('HelpDesk'),
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\Settings_AutomaticAssignment_Record_Model' in method 'testUpdate'. Open
$autoAssignInstance = \Settings_AutomaticAssignment_Record_Model::getInstanceById(self::$autoAssign);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\Settings_AutomaticAssignment_Record_Model' in method 'testDelete'. Open
$autoAssignInstance = \Settings_AutomaticAssignment_Record_Model::getInstanceById(self::$autoAssign);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\Users_Record_Model' in method 'tearDownAfterClass'. Open
\Users_Record_Model::deleteUserPermanently($recordModel->getId(), \App\User::getCurrentUserId());
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\User' in method 'setUpBeforeClass'. Open
\App\User::setCurrentUserId(\App\User::getActiveAdminId());
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Module' in method 'setUpBeforeClass'. Open
$recordModel->set('modules', $recordModel->getFieldInstanceByName('modules')->getDBValue([\App\Module::getModuleId('HelpDesk')]));
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Encryption' in method 'createUserRecord'. Open
$pwd = \App\Encryption::generatePassword(10);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\YetiForce\Shop' in method 'testHandler'. Open
if (!\App\YetiForce\Shop::check('YetiForceAutoAssignment')) {
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\AutoAssign' in method 'testRoundRobin'. Open
$autoAssignModel = \App\AutoAssign::getInstanceById(self::$autoAssign);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\User' in method 'tearDownAfterClass'. Open
\Users_Record_Model::deleteUserPermanently($recordModel->getId(), \App\User::getCurrentUserId());
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\User' in method 'tearDownAfterClass'. Open
\Users_Record_Model::deleteUserPermanently(self::$defaultUser->getId(), \App\User::getCurrentUserId());
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\Settings_AutomaticAssignment_Record_Model' in method 'testDelete'. Open
$autoAssignInstance = \Settings_AutomaticAssignment_Record_Model::getInstanceById(self::$autoAssign);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\Settings_AutomaticAssignment_Record_Model' in method 'testCreate'. Open
$recordModel = \Settings_AutomaticAssignment_Record_Model::getCleanInstance();
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\Vtiger_Record_Model' in method 'createTicket'. Open
$recordModel = \Vtiger_Record_Model::getCleanInstance('HelpDesk');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\Settings_AutomaticAssignment_Record_Model' in method 'testCreate'. Open
$autoAssignInstance = \Settings_AutomaticAssignment_Record_Model::getInstanceById($recordModel->getId());
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Db' in method 'testUpdate'. Open
->exists(\App\Db::getInstance('admin'));
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\Vtiger_Record_Model' in method 'createUserRecord'. Open
$user = \Vtiger_Record_Model::getCleanInstance('Users');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\YetiForce\Shop' in method 'testRoundRobin'. Open
if (!\App\YetiForce\Shop::check('YetiForceAutoAssignment')) {
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
syntax error, unexpected '=>' (T_DOUBLE_ARROW), expecting ',' or ')'
Open
self::$autoAssignUsers = array_filter(array_map(fn ($userModel) => $userModel->get('auto_assign') ? $userModel->getId() : null, self::$users));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* List of users who can be assigned.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Default user model.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
private static $autoAssign;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @codeCoverageIgnore
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function setUpBeforeClass(): void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\User::setCurrentUserId(\App\User::getActiveAdminId());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel->set('modules', $recordModel->getFieldInstanceByName('modules')->getDBValue([\App\Module::getModuleId('HelpDesk')]));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* List of users.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
self::$users['assignUserNo'] = self::createUserRecord('assignUserNo');
- Exclude checks
Line exceeds 120 characters; contains 151 characters Open
self::$autoAssignUsers = array_filter(array_map(fn ($userModel) => $userModel->get('auto_assign') ? $userModel->getId() : null, self::$users));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach (self::$tickets as $recordModel) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var int[]
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Auto Assign record model ID.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Group ID.
- Exclude checks
Line exceeds 120 characters; contains 124 characters Open
self::$users['assignUserYes'] = self::createUserRecord('assignUserYes', ['available' => '1', 'auto_assign' => '1']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\Users_Record_Model::deleteUserPermanently($recordModel->getId(), \App\User::getCurrentUserId());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
private static $users = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
private static $autoAssignUsers = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Tickets created.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var \Vtiger_Record_Model[]
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
self::$defaultUser = self::createUserRecord('assignUserDefault');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
self::$autoAssignUsers = array_filter(array_map(fn ($userModel) => $userModel->get('auto_assign') ? $userModel->getId() : null, self::$users));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
private static $tickets = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel->save();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel->delete();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach (self::$users as $recordModel) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Setting of tests.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
self::$users['assignUserYes2'] = self::createUserRecord('assignUserYes2', ['available' => '1', 'auto_assign' => '1']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel = \Settings_Groups_Record_Model::getCleanInstance();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
private static $groupId;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var int
- Exclude checks
Line exceeds 120 characters; contains 126 characters Open
self::$users['assignUserYes2'] = self::createUserRecord('assignUserYes2', ['available' => '1', 'auto_assign' => '1']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\Users_Record_Model::deleteUserPermanently(self::$defaultUser->getId(), \App\User::getCurrentUserId());
- Exclude checks
Line exceeds 120 characters; contains 138 characters Open
$recordModel->set('modules', $recordModel->getFieldInstanceByName('modules')->getDBValue([\App\Module::getModuleId('HelpDesk')]));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Cleaning after tests.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Create user.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var \Vtiger_Record_Model
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var int
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel->set('groupname', 'Support groups');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function tearDownAfterClass(): void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var \Vtiger_Record_Model[]
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$members = array_map(fn ($userModel) => \App\PrivilegeUtil::MEMBER_TYPE_USERS . ':' . $userModel->getId(), self::$users);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel->set('description', 'Test description');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel->set('members', $recordModel->getFieldInstanceByName('members')->getDBValue($members));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
private static $defaultUser;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
self::$users['assignUserYes'] = self::createUserRecord('assignUserYes', ['available' => '1', 'auto_assign' => '1']);
- Exclude checks
Line exceeds 120 characters; contains 129 characters Open
$members = array_map(fn ($userModel) => \App\PrivilegeUtil::MEMBER_TYPE_USERS . ':' . $userModel->getId(), self::$users);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
self::$groupId = $recordModel->getId();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($userData as $key => $values) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$user->save();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel->set('assigned_user_id', $owner);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$newData = $autoAssignInstance->getData();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Testing handler.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!\App\YetiForce\Shop::check('YetiForceAutoAssignment')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Testing assign record.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel->set('parent_id', \Tests\Base\C_RecordActions::createAccountRecord()->getId());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Testing create auto assign record.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'handler' => 1,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'gui' => 1,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$handlers = (new \App\EventHandler())->setModuleName('HelpDesk')->getHandlers('EntityBeforeSave');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function testRoundRobin()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertContains($owner, self::$autoAssignUsers, 'Wrong ticket owner assign');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $login
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$pwd = \App\Encryption::generatePassword(10);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'roleid' => 'H2',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function createTicket(int $owner): \Vtiger_Record_Model
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->markTestSkipped('No required access to test this functionality');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'record_limit' => 0,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame(ksort($data), ksort($newData), 'Data mismatch');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$user = self::$users['assignUserNo'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$autoAssignInstance = \Settings_AutomaticAssignment_Record_Model::getInstanceById(self::$autoAssign);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$expectedNextOwner = $assigned[$key + 1] ?? $assigned[0];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'user_name' => $login,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'workflow' => 1,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$autoAssignInstance = \Settings_AutomaticAssignment_Record_Model::getInstanceById($recordModel->getId());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->markTestSkipped('No required access to test this functionality');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$possibleOwners = array_diff($possibleOwners, [$owner]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
for ($i = 0; $i < \count(self::$autoAssignUsers); ++$i) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$autoAssignModel = \App\AutoAssign::getInstanceById(self::$autoAssign);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel = \Vtiger_Record_Model::getCleanInstance('HelpDesk');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'subject' => 'Auto Assign',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertArrayHasKey('Vtiger_AutoAssign_Handler', $handlers, 'The handler should be set up');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function testHandler()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$owner = $recordModel->get('assigned_user_id');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel = self::createTicket($user->getId());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Removal test.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertNull($autoAssignInstance->getId(), 'Assign record should not exists');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $user;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function testCreate()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'state' => \App\AutoAssign::STATUS_ACTIVE,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel->setDataFromRequest($request);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Testing round robin method.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$assigned = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame($owner, $ownerId, 'Wrong ticket owner assign');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertTrue($autoAssignInstance->delete(), 'The delete function should return true');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$handlers = (new \App\EventHandler())->setModuleName('HelpDesk')->getHandlers('EntityBeforeSave');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param array $data
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'confirm_password', $pwd,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
self::$tickets[$recordModel->getId()] = $recordModel;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'conditions' => '{"condition":"AND","rules":[{"fieldname":"assigned_user_id:HelpDesk","operator":"e","value":"' . self::$groupId . '"}]}',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'members' => [\App\PrivilegeUtil::MEMBER_TYPE_GROUPS . ':' . self::$groupId],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel = self::createTicket(self::$groupId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$owner = $recordModel->get('assigned_user_id');
- Exclude checks
Line exceeds 120 characters; contains 130 characters Open
$this->assertSame($expectedNextOwner, $autoAssignModel->getQueryByRoundRobin()->scalar(), 'Incorrect user selection');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'user_password', $pwd,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel->save();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$request = new \App\Request([
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function testUpdate()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$isChange = (new \App\Db\Query())
- Exclude checks
Line exceeds 120 characters; contains 140 characters Open
->where([$autoAssignInstance->getTableIndex() => $autoAssignInstance->getId(), 'method' => \App\AutoAssign::METHOD_ROUND_ROBIN])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $expectedNextOwner
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame($expectedNextOwner, $autoAssignModel->getQueryByRoundRobin()->scalar(), 'Incorrect user selection');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$autoAssignInstance = \Settings_AutomaticAssignment_Record_Model::getInstanceById(self::$autoAssign);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertFalse(isset($handlers['Vtiger_AutoAssign_Handler']), 'The handler should not be active');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$user = \Vtiger_Record_Model::getCleanInstance('Users');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
], $data);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Undocumented function.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel->set('ticket_title', 'Ticket' . random_int(0, 10));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertContains($owner, $possibleOwners, 'Wrong ticket owner assign:' . print_r($possibleOwners, true));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->from($autoAssignInstance->getTable())
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$assigned[$i] = $recordModel->get('assigned_user_id');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return \Users_Record_Model
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'first_name' => "{$login}Name",
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'last_name' => "{$login}Surname",
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Line exceeds 120 characters; contains 150 characters Open
'conditions' => '{"condition":"AND","rules":[{"fieldname":"assigned_user_id:HelpDesk","operator":"e","value":"' . self::$groupId . '"}]}',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'default_assign' => self::$defaultUser->getId(),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'record_limit_conditions' => '',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertContains($owner, $possibleOwners, 'Wrong ticket owner assign.');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!\App\YetiForce\Shop::check('YetiForceAutoAssignment')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$autoAssignInstance = \Settings_AutomaticAssignment_Record_Model::getInstanceById(self::$autoAssign);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function createUserRecord($login = 'demo', $data = []): \Vtiger_Record_Model
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$user->set($key, $values);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $owner
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'tabid' => \App\Module::getModuleId('HelpDesk'),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'method' => \App\AutoAssign::METHOD_LOAD_BALANCE,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel->save();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel = self::createTicket(self::$groupId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$owner = $recordModel->get('assigned_user_id');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$autoAssignInstance->set('method', \App\AutoAssign::METHOD_ROUND_ROBIN);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel = self::createTicket(self::$groupId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @codeCoverageIgnore
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'is_admin' => 'off',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $recordModel;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel = \Settings_AutomaticAssignment_Record_Model::getCleanInstance();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$possibleOwners = self::$autoAssignUsers;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->where([$autoAssignInstance->getTableIndex() => $autoAssignInstance->getId(), 'method' => \App\AutoAssign::METHOD_ROUND_ROBIN])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->exists(\App\Db::getInstance('admin'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertTrue($isChange, 'Auto assign method should change');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel = self::createTicket(self::$groupId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$userData = array_merge([
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame($user->getId(), $recordModel->get('assigned_user_id'), 'Wrong ticket owner');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'email1' => "{$login}@yetiforce.com",
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return \Vtiger_Record_Model
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel->set('ticketstatus', 'Open');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
self::$autoAssign = $recordModel->getId();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$data = $recordModel->getData();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$autoAssignInstance->save();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $expectedCurrentOwner
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($assigned as $key => $ownerId) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function testDelete()
- Exclude checks
Space before opening parenthesis of function call prohibited Open
self::$autoAssignUsers = array_filter(array_map(fn ($userModel) => $userModel->get('auto_assign') ? $userModel->getId() : null, self::$users));
- Exclude checks
Space before opening parenthesis of function call prohibited Open
$members = array_map(fn ($userModel) => \App\PrivilegeUtil::MEMBER_TYPE_USERS . ':' . $userModel->getId(), self::$users);
- Exclude checks