YetiForceCompany/YetiForceCRM

View on GitHub
tests/Settings/AutoAssign.php

Summary

Maintainability
A
0 mins
Test Coverage
A
100%

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.
     *
Severity: Minor
Found in tests/Settings/AutoAssign.php by phpmd

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())
Severity: Minor
Found in tests/Settings/AutoAssign.php by phpmd

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');
Severity: Minor
Found in tests/Settings/AutoAssign.php by phpmd

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([
Severity: Minor
Found in tests/Settings/AutoAssign.php by phpmd

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');
Severity: Minor
Found in tests/Settings/AutoAssign.php by phpmd

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();
Severity: Minor
Found in tests/Settings/AutoAssign.php by phpmd

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());
Severity: Minor
Found in tests/Settings/AutoAssign.php by phpmd

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());
Severity: Minor
Found in tests/Settings/AutoAssign.php by phpmd

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'),
Severity: Minor
Found in tests/Settings/AutoAssign.php by phpmd

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);
Severity: Minor
Found in tests/Settings/AutoAssign.php by phpmd

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);
Severity: Minor
Found in tests/Settings/AutoAssign.php by phpmd

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());
Severity: Minor
Found in tests/Settings/AutoAssign.php by phpmd

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());
Severity: Minor
Found in tests/Settings/AutoAssign.php by phpmd

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')]));
Severity: Minor
Found in tests/Settings/AutoAssign.php by phpmd

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);
Severity: Minor
Found in tests/Settings/AutoAssign.php by phpmd

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')) {
Severity: Minor
Found in tests/Settings/AutoAssign.php by phpmd

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);
Severity: Minor
Found in tests/Settings/AutoAssign.php by phpmd

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());
Severity: Minor
Found in tests/Settings/AutoAssign.php by phpmd

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());
Severity: Minor
Found in tests/Settings/AutoAssign.php by phpmd

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);
Severity: Minor
Found in tests/Settings/AutoAssign.php by phpmd

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();
Severity: Minor
Found in tests/Settings/AutoAssign.php by phpmd

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');
Severity: Minor
Found in tests/Settings/AutoAssign.php by phpmd

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());
Severity: Minor
Found in tests/Settings/AutoAssign.php by phpmd

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'));
Severity: Minor
Found in tests/Settings/AutoAssign.php by phpmd

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');
Severity: Minor
Found in tests/Settings/AutoAssign.php by phpmd

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')) {
Severity: Minor
Found in tests/Settings/AutoAssign.php by phpmd

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));
Severity: Critical
Found in tests/Settings/AutoAssign.php by phan

Spaces must be used to indent lines; tabs are not allowed
Open

     * List of users who can be assigned.

Spaces must be used to indent lines; tabs are not allowed
Open

     * Default user model.

Spaces must be used to indent lines; tabs are not allowed
Open

    /**

Spaces must be used to indent lines; tabs are not allowed
Open

    private static $autoAssign;

Spaces must be used to indent lines; tabs are not allowed
Open

     * @codeCoverageIgnore

Spaces must be used to indent lines; tabs are not allowed
Open

     */

Spaces must be used to indent lines; tabs are not allowed
Open

    public static function setUpBeforeClass(): void

Spaces must be used to indent lines; tabs are not allowed
Open

        \App\User::setCurrentUserId(\App\User::getActiveAdminId());

Spaces must be used to indent lines; tabs are not allowed
Open

        $recordModel->set('modules', $recordModel->getFieldInstanceByName('modules')->getDBValue([\App\Module::getModuleId('HelpDesk')]));

Spaces must be used to indent lines; tabs are not allowed
Open

    /**

Spaces must be used to indent lines; tabs are not allowed
Open

     * List of users.

Spaces must be used to indent lines; tabs are not allowed
Open

    /**

Spaces must be used to indent lines; tabs are not allowed
Open

        self::$users['assignUserNo'] = self::createUserRecord('assignUserNo');

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));

Spaces must be used to indent lines; tabs are not allowed
Open

        }

Spaces must be used to indent lines; tabs are not allowed
Open

    /**

Spaces must be used to indent lines; tabs are not allowed
Open

     */

Spaces must be used to indent lines; tabs are not allowed
Open

    /**

Spaces must be used to indent lines; tabs are not allowed
Open

     */

Spaces must be used to indent lines; tabs are not allowed
Open

        foreach (self::$tickets as $recordModel) {

Spaces must be used to indent lines; tabs are not allowed
Open

     * @var int[]

Spaces must be used to indent lines; tabs are not allowed
Open

    /**

Spaces must be used to indent lines; tabs are not allowed
Open

     *

Spaces must be used to indent lines; tabs are not allowed
Open

     * Auto Assign record model ID.

Spaces must be used to indent lines; tabs are not allowed
Open

     */

Spaces must be used to indent lines; tabs are not allowed
Open

     * Group ID.

Line exceeds 120 characters; contains 124 characters
Open

        self::$users['assignUserYes'] = self::createUserRecord('assignUserYes', ['available' => '1', 'auto_assign' => '1']);

Spaces must be used to indent lines; tabs are not allowed
Open

            \Users_Record_Model::deleteUserPermanently($recordModel->getId(), \App\User::getCurrentUserId());

Spaces must be used to indent lines; tabs are not allowed
Open

    private static $users = [];

Spaces must be used to indent lines; tabs are not allowed
Open

        }

Spaces must be used to indent lines; tabs are not allowed
Open

     */

Spaces must be used to indent lines; tabs are not allowed
Open

    private static $autoAssignUsers = [];

Spaces must be used to indent lines; tabs are not allowed
Open

     * Tickets created.

Spaces must be used to indent lines; tabs are not allowed
Open

     * @var \Vtiger_Record_Model[]

Spaces must be used to indent lines; tabs are not allowed
Open

        self::$defaultUser = self::createUserRecord('assignUserDefault');

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));

Spaces must be used to indent lines; tabs are not allowed
Open

    private static $tickets = [];

Spaces must be used to indent lines; tabs are not allowed
Open

        $recordModel->save();

Spaces must be used to indent lines; tabs are not allowed
Open

            $recordModel->delete();

Spaces must be used to indent lines; tabs are not allowed
Open

    }

Spaces must be used to indent lines; tabs are not allowed
Open

        foreach (self::$users as $recordModel) {

Spaces must be used to indent lines; tabs are not allowed
Open

     *

Spaces must be used to indent lines; tabs are not allowed
Open

     */

Spaces must be used to indent lines; tabs are not allowed
Open

    /**

Spaces must be used to indent lines; tabs are not allowed
Open

     * Setting of tests.

Spaces must be used to indent lines; tabs are not allowed
Open

        self::$users['assignUserYes2'] = self::createUserRecord('assignUserYes2', ['available' => '1', 'auto_assign' => '1']);

Spaces must be used to indent lines; tabs are not allowed
Open

        $recordModel = \Settings_Groups_Record_Model::getCleanInstance();

Spaces must be used to indent lines; tabs are not allowed
Open

    /**

Spaces must be used to indent lines; tabs are not allowed
Open

     */

Spaces must be used to indent lines; tabs are not allowed
Open

     *

Spaces must be used to indent lines; tabs are not allowed
Open

    private static $groupId;

Spaces must be used to indent lines; tabs are not allowed
Open

     * @var int

Line exceeds 120 characters; contains 126 characters
Open

        self::$users['assignUserYes2'] = self::createUserRecord('assignUserYes2', ['available' => '1', 'auto_assign' => '1']);

Spaces must be used to indent lines; tabs are not allowed
Open

        \Users_Record_Model::deleteUserPermanently(self::$defaultUser->getId(), \App\User::getCurrentUserId());

Line exceeds 120 characters; contains 138 characters
Open

        $recordModel->set('modules', $recordModel->getFieldInstanceByName('modules')->getDBValue([\App\Module::getModuleId('HelpDesk')]));

Spaces must be used to indent lines; tabs are not allowed
Open

     * Cleaning after tests.

Spaces must be used to indent lines; tabs are not allowed
Open

     *

Spaces must be used to indent lines; tabs are not allowed
Open

    {

Spaces must be used to indent lines; tabs are not allowed
Open

    }

Spaces must be used to indent lines; tabs are not allowed
Open

     * Create user.

Spaces must be used to indent lines; tabs are not allowed
Open

    {

Spaces must be used to indent lines; tabs are not allowed
Open

     * @var \Vtiger_Record_Model

Spaces must be used to indent lines; tabs are not allowed
Open

     * @var int

Spaces must be used to indent lines; tabs are not allowed
Open

     *

Spaces must be used to indent lines; tabs are not allowed
Open

        $recordModel->set('groupname', 'Support groups');

Spaces must be used to indent lines; tabs are not allowed
Open

     * @return void

Spaces must be used to indent lines; tabs are not allowed
Open

    public static function tearDownAfterClass(): void

Spaces must be used to indent lines; tabs are not allowed
Open

     * @var \Vtiger_Record_Model[]

Spaces must be used to indent lines; tabs are not allowed
Open

     *

Spaces must be used to indent lines; tabs are not allowed
Open

     *

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);

Spaces must be used to indent lines; tabs are not allowed
Open

        $recordModel->set('description', 'Test description');

Spaces must be used to indent lines; tabs are not allowed
Open

        $recordModel->set('members', $recordModel->getFieldInstanceByName('members')->getDBValue($members));

Spaces must be used to indent lines; tabs are not allowed
Open

     */

Spaces must be used to indent lines; tabs are not allowed
Open

    private static $defaultUser;

Spaces must be used to indent lines; tabs are not allowed
Open

    /**

Spaces must be used to indent lines; tabs are not allowed
Open

        self::$users['assignUserYes'] = self::createUserRecord('assignUserYes', ['available' => '1', 'auto_assign' => '1']);

Line exceeds 120 characters; contains 129 characters
Open

        $members = array_map(fn ($userModel) => \App\PrivilegeUtil::MEMBER_TYPE_USERS . ':' . $userModel->getId(), self::$users);

Spaces must be used to indent lines; tabs are not allowed
Open

        self::$groupId = $recordModel->getId();

Spaces must be used to indent lines; tabs are not allowed
Open

        foreach ($userData as $key => $values) {

Spaces must be used to indent lines; tabs are not allowed
Open

        $user->save();

Spaces must be used to indent lines; tabs are not allowed
Open

        $recordModel->set('assigned_user_id', $owner);

Spaces must be used to indent lines; tabs are not allowed
Open

        $newData = $autoAssignInstance->getData();

Spaces must be used to indent lines; tabs are not allowed
Open

     * Testing handler.

Spaces must be used to indent lines; tabs are not allowed
Open

        if (!\App\YetiForce\Shop::check('YetiForceAutoAssignment')) {

Spaces must be used to indent lines; tabs are not allowed
Open

     * Testing assign record.

Spaces must be used to indent lines; tabs are not allowed
Open

    /**

Spaces must be used to indent lines; tabs are not allowed
Open

     *

Spaces must be used to indent lines; tabs are not allowed
Open

        $recordModel->set('parent_id', \Tests\Base\C_RecordActions::createAccountRecord()->getId());

Spaces must be used to indent lines; tabs are not allowed
Open

     * Testing create auto assign record.

Spaces must be used to indent lines; tabs are not allowed
Open

            'handler' => 1,

Spaces must be used to indent lines; tabs are not allowed
Open

            'gui' => 1,

Spaces must be used to indent lines; tabs are not allowed
Open

        $handlers = (new \App\EventHandler())->setModuleName('HelpDesk')->getHandlers('EntityBeforeSave');

Spaces must be used to indent lines; tabs are not allowed
Open

    public function testRoundRobin()

Spaces must be used to indent lines; tabs are not allowed
Open

            $this->assertContains($owner, self::$autoAssignUsers, 'Wrong ticket owner assign');

Spaces must be used to indent lines; tabs are not allowed
Open

     * @param string $login

Spaces must be used to indent lines; tabs are not allowed
Open

        $pwd = \App\Encryption::generatePassword(10);

Spaces must be used to indent lines; tabs are not allowed
Open

            'roleid' => 'H2',

Spaces must be used to indent lines; tabs are not allowed
Open

    public static function createTicket(int $owner): \Vtiger_Record_Model

Spaces must be used to indent lines; tabs are not allowed
Open

    }

Spaces must be used to indent lines; tabs are not allowed
Open

            $this->markTestSkipped('No required access to test this functionality');

Spaces must be used to indent lines; tabs are not allowed
Open

    }

Spaces must be used to indent lines; tabs are not allowed
Open

        }

Spaces must be used to indent lines; tabs are not allowed
Open

     *

Spaces must be used to indent lines; tabs are not allowed
Open

    {

Spaces must be used to indent lines; tabs are not allowed
Open

            'record_limit' => 0,

Spaces must be used to indent lines; tabs are not allowed
Open

        $this->assertSame(ksort($data), ksort($newData), 'Data mismatch');

Spaces must be used to indent lines; tabs are not allowed
Open

        $user = self::$users['assignUserNo'];

Spaces must be used to indent lines; tabs are not allowed
Open

        $autoAssignInstance = \Settings_AutomaticAssignment_Record_Model::getInstanceById(self::$autoAssign);

Spaces must be used to indent lines; tabs are not allowed
Open

            return;

Spaces must be used to indent lines; tabs are not allowed
Open

            $expectedNextOwner = $assigned[$key + 1] ?? $assigned[0];

Spaces must be used to indent lines; tabs are not allowed
Open

            'user_name' => $login,

Spaces must be used to indent lines; tabs are not allowed
Open

     *

Spaces must be used to indent lines; tabs are not allowed
Open

            'workflow' => 1,

Spaces must be used to indent lines; tabs are not allowed
Open

        $autoAssignInstance = \Settings_AutomaticAssignment_Record_Model::getInstanceById($recordModel->getId());

Spaces must be used to indent lines; tabs are not allowed
Open

            $this->markTestSkipped('No required access to test this functionality');

Spaces must be used to indent lines; tabs are not allowed
Open

        $possibleOwners = array_diff($possibleOwners, [$owner]);

Spaces must be used to indent lines; tabs are not allowed
Open

    {

Spaces must be used to indent lines; tabs are not allowed
Open

        for ($i = 0; $i < \count(self::$autoAssignUsers); ++$i) {

Spaces must be used to indent lines; tabs are not allowed
Open

        $autoAssignModel = \App\AutoAssign::getInstanceById(self::$autoAssign);

Spaces must be used to indent lines; tabs are not allowed
Open

        $recordModel = \Vtiger_Record_Model::getCleanInstance('HelpDesk');

Spaces must be used to indent lines; tabs are not allowed
Open

            'subject' => 'Auto Assign',

Spaces must be used to indent lines; tabs are not allowed
Open

        $this->assertArrayHasKey('Vtiger_AutoAssign_Handler', $handlers, 'The handler should be set up');

Spaces must be used to indent lines; tabs are not allowed
Open

    /**

Spaces must be used to indent lines; tabs are not allowed
Open

    public function testHandler()

Spaces must be used to indent lines; tabs are not allowed
Open

        $owner = $recordModel->get('assigned_user_id');

Spaces must be used to indent lines; tabs are not allowed
Open

        $recordModel = self::createTicket($user->getId());

Spaces must be used to indent lines; tabs are not allowed
Open

     */

Spaces must be used to indent lines; tabs are not allowed
Open

    /**

Spaces must be used to indent lines; tabs are not allowed
Open

     * Removal test.

Spaces must be used to indent lines; tabs are not allowed
Open

        $this->assertNull($autoAssignInstance->getId(), 'Assign record should not exists');

Spaces must be used to indent lines; tabs are not allowed
Open

     *

Spaces must be used to indent lines; tabs are not allowed
Open

        return $user;

Spaces must be used to indent lines; tabs are not allowed
Open

    public function testCreate()

Spaces must be used to indent lines; tabs are not allowed
Open

            'state' => \App\AutoAssign::STATUS_ACTIVE,

Spaces must be used to indent lines; tabs are not allowed
Open

        $recordModel->setDataFromRequest($request);

Spaces must be used to indent lines; tabs are not allowed
Open

     * Testing round robin method.

Spaces must be used to indent lines; tabs are not allowed
Open

     *

Spaces must be used to indent lines; tabs are not allowed
Open

        $assigned = [];

Spaces must be used to indent lines; tabs are not allowed
Open

            $this->assertSame($owner, $ownerId, 'Wrong ticket owner assign');

Spaces must be used to indent lines; tabs are not allowed
Open

        $this->assertTrue($autoAssignInstance->delete(), 'The delete function should return true');

Spaces must be used to indent lines; tabs are not allowed
Open

        $handlers = (new \App\EventHandler())->setModuleName('HelpDesk')->getHandlers('EntityBeforeSave');

Spaces must be used to indent lines; tabs are not allowed
Open

     *

Spaces must be used to indent lines; tabs are not allowed
Open

     * @param array  $data

Spaces must be used to indent lines; tabs are not allowed
Open

            'confirm_password', $pwd,

Spaces must be used to indent lines; tabs are not allowed
Open

        self::$tickets[$recordModel->getId()] = $recordModel;

Spaces must be used to indent lines; tabs are not allowed
Open

     */

Spaces must be used to indent lines; tabs are not allowed
Open

    {

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 . '"}]}',

Spaces must be used to indent lines; tabs are not allowed
Open

            'members' => [\App\PrivilegeUtil::MEMBER_TYPE_GROUPS . ':' . self::$groupId],

Spaces must be used to indent lines; tabs are not allowed
Open

        $recordModel = self::createTicket(self::$groupId);

Spaces must be used to indent lines; tabs are not allowed
Open

    /**

Spaces must be used to indent lines; tabs are not allowed
Open

        }

Spaces must be used to indent lines; tabs are not allowed
Open

            $owner = $recordModel->get('assigned_user_id');

Line exceeds 120 characters; contains 130 characters
Open

            $this->assertSame($expectedNextOwner, $autoAssignModel->getQueryByRoundRobin()->scalar(), 'Incorrect user selection');

Spaces must be used to indent lines; tabs are not allowed
Open

    {

Spaces must be used to indent lines; tabs are not allowed
Open

            'user_password', $pwd,

Spaces must be used to indent lines; tabs are not allowed
Open

     */

Spaces must be used to indent lines; tabs are not allowed
Open

        $recordModel->save();

Spaces must be used to indent lines; tabs are not allowed
Open

        $request = new \App\Request([

Spaces must be used to indent lines; tabs are not allowed
Open

        ]);

Spaces must be used to indent lines; tabs are not allowed
Open

    public function testUpdate()

Spaces must be used to indent lines; tabs are not allowed
Open

        $isChange = (new \App\Db\Query())

Line exceeds 120 characters; contains 140 characters
Open

            ->where([$autoAssignInstance->getTableIndex() => $autoAssignInstance->getId(), 'method' => \App\AutoAssign::METHOD_ROUND_ROBIN])

Spaces must be used to indent lines; tabs are not allowed
Open

    }

Spaces must be used to indent lines; tabs are not allowed
Open

     * @param int $expectedNextOwner

Spaces must be used to indent lines; tabs are not allowed
Open

            $this->assertSame($expectedNextOwner, $autoAssignModel->getQueryByRoundRobin()->scalar(), 'Incorrect user selection');

Spaces must be used to indent lines; tabs are not allowed
Open

        $autoAssignInstance = \Settings_AutomaticAssignment_Record_Model::getInstanceById(self::$autoAssign);

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');

Spaces must be used to indent lines; tabs are not allowed
Open

        $user = \Vtiger_Record_Model::getCleanInstance('Users');

Spaces must be used to indent lines; tabs are not allowed
Open

        ], $data);

Spaces must be used to indent lines; tabs are not allowed
Open

     * Undocumented function.

Spaces must be used to indent lines; tabs are not allowed
Open

        $recordModel->set('ticket_title', 'Ticket' . random_int(0, 10));

Spaces must be used to indent lines; tabs are not allowed
Open

    {

Spaces must be used to indent lines; tabs are not allowed
Open

        $this->assertContains($owner, $possibleOwners, 'Wrong ticket owner assign:' . print_r($possibleOwners, true));

Spaces must be used to indent lines; tabs are not allowed
Open

            ->from($autoAssignInstance->getTable())

Spaces must be used to indent lines; tabs are not allowed
Open

            $assigned[$i] = $recordModel->get('assigned_user_id');

Spaces must be used to indent lines; tabs are not allowed
Open

     * @return \Users_Record_Model

Spaces must be used to indent lines; tabs are not allowed
Open

            'first_name' => "{$login}Name",

Spaces must be used to indent lines; tabs are not allowed
Open

            'last_name' => "{$login}Surname",

Spaces must be used to indent lines; tabs are not allowed
Open

    /**

Line exceeds 120 characters; contains 150 characters
Open

            'conditions' => '{"condition":"AND","rules":[{"fieldname":"assigned_user_id:HelpDesk","operator":"e","value":"' . self::$groupId . '"}]}',

Spaces must be used to indent lines; tabs are not allowed
Open

            'default_assign' => self::$defaultUser->getId(),

Spaces must be used to indent lines; tabs are not allowed
Open

            'record_limit_conditions' => '',

Spaces must be used to indent lines; tabs are not allowed
Open

     */

Spaces must be used to indent lines; tabs are not allowed
Open

        }

Spaces must be used to indent lines; tabs are not allowed
Open

        $this->assertContains($owner, $possibleOwners, 'Wrong ticket owner assign.');

Spaces must be used to indent lines; tabs are not allowed
Open

        if (!\App\YetiForce\Shop::check('YetiForceAutoAssignment')) {

Spaces must be used to indent lines; tabs are not allowed
Open

     */

Spaces must be used to indent lines; tabs are not allowed
Open

    {

Spaces must be used to indent lines; tabs are not allowed
Open

    {

Spaces must be used to indent lines; tabs are not allowed
Open

        $autoAssignInstance = \Settings_AutomaticAssignment_Record_Model::getInstanceById(self::$autoAssign);

Spaces must be used to indent lines; tabs are not allowed
Open

     */

Spaces must be used to indent lines; tabs are not allowed
Open

    public static function createUserRecord($login = 'demo', $data = []): \Vtiger_Record_Model

Spaces must be used to indent lines; tabs are not allowed
Open

            $user->set($key, $values);

Spaces must be used to indent lines; tabs are not allowed
Open

     * @param int $owner

Spaces must be used to indent lines; tabs are not allowed
Open

            'tabid' => \App\Module::getModuleId('HelpDesk'),

Spaces must be used to indent lines; tabs are not allowed
Open

            'method' => \App\AutoAssign::METHOD_LOAD_BALANCE,

Spaces must be used to indent lines; tabs are not allowed
Open

        $recordModel->save();

Spaces must be used to indent lines; tabs are not allowed
Open

    }

Spaces must be used to indent lines; tabs are not allowed
Open

        $recordModel = self::createTicket(self::$groupId);

Spaces must be used to indent lines; tabs are not allowed
Open

        $owner = $recordModel->get('assigned_user_id');

Spaces must be used to indent lines; tabs are not allowed
Open

     */

Spaces must be used to indent lines; tabs are not allowed
Open

        $autoAssignInstance->set('method', \App\AutoAssign::METHOD_ROUND_ROBIN);

Spaces must be used to indent lines; tabs are not allowed
Open

            $recordModel = self::createTicket(self::$groupId);

Spaces must be used to indent lines; tabs are not allowed
Open

        }

Spaces must be used to indent lines; tabs are not allowed
Open

     * @codeCoverageIgnore

Spaces must be used to indent lines; tabs are not allowed
Open

            'is_admin' => 'off',

Spaces must be used to indent lines; tabs are not allowed
Open

        return $recordModel;

Spaces must be used to indent lines; tabs are not allowed
Open

    }

Spaces must be used to indent lines; tabs are not allowed
Open

        $recordModel = \Settings_AutomaticAssignment_Record_Model::getCleanInstance();

Spaces must be used to indent lines; tabs are not allowed
Open

            return;

Spaces must be used to indent lines; tabs are not allowed
Open

        $possibleOwners = self::$autoAssignUsers;

Spaces must be used to indent lines; tabs are not allowed
Open

            ->where([$autoAssignInstance->getTableIndex() => $autoAssignInstance->getId(), 'method' => \App\AutoAssign::METHOD_ROUND_ROBIN])

Spaces must be used to indent lines; tabs are not allowed
Open

            ->exists(\App\Db::getInstance('admin'));

Spaces must be used to indent lines; tabs are not allowed
Open

        $this->assertTrue($isChange, 'Auto assign method should change');

Spaces must be used to indent lines; tabs are not allowed
Open

            $recordModel = self::createTicket(self::$groupId);

Spaces must be used to indent lines; tabs are not allowed
Open

        $userData = array_merge([

Spaces must be used to indent lines; tabs are not allowed
Open

        $this->assertSame($user->getId(), $recordModel->get('assigned_user_id'), 'Wrong ticket owner');

Spaces must be used to indent lines; tabs are not allowed
Open

            'email1' => "{$login}@yetiforce.com",

Spaces must be used to indent lines; tabs are not allowed
Open

    }

Spaces must be used to indent lines; tabs are not allowed
Open

     * @return \Vtiger_Record_Model

Spaces must be used to indent lines; tabs are not allowed
Open

        $recordModel->set('ticketstatus', 'Open');

Spaces must be used to indent lines; tabs are not allowed
Open

    /**

Spaces must be used to indent lines; tabs are not allowed
Open

        self::$autoAssign = $recordModel->getId();

Spaces must be used to indent lines; tabs are not allowed
Open

        $data = $recordModel->getData();

Spaces must be used to indent lines; tabs are not allowed
Open

        $autoAssignInstance->save();

Spaces must be used to indent lines; tabs are not allowed
Open

     * @param int $expectedCurrentOwner

Spaces must be used to indent lines; tabs are not allowed
Open

        }

Spaces must be used to indent lines; tabs are not allowed
Open

        foreach ($assigned as $key => $ownerId) {

Spaces must be used to indent lines; tabs are not allowed
Open

    }

Spaces must be used to indent lines; tabs are not allowed
Open

    public function testDelete()

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));

Space before opening parenthesis of function call prohibited
Open

        $members = array_map(fn ($userModel) => \App\PrivilegeUtil::MEMBER_TYPE_USERS . ':' . $userModel->getId(), self::$users);

There are no issues that match your filters.

Category
Status