YetiForceCompany/YetiForceCRM

View on GitHub
tests/Settings/Groups.php

Summary

Maintainability
A
1 hr
Test Coverage
A
100%

Method testAddGroups has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function testAddGroups()
    {
        $modules = ['4', '7'];
        $recordModel = \Settings_Groups_Record_Model::getCleanInstance();
        $recordModel->set('groupname', 'Test groups');
Severity: Minor
Found in tests/Settings/Groups.php - About 1 hr to fix

    Missing class import via use statement (line '54', column '20').
    Open

            $group2Rs = (new \App\Db\Query())->from('vtiger_group2rs')->select(['roleandsubid'])->where(['groupid' => self::$id])->column();
    Severity: Minor
    Found in tests/Settings/Groups.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 '77', column '15').
    Open

            $row = (new \App\Db\Query())->from('vtiger_groups')->where(['groupid' => self::$id])->one();
    Severity: Minor
    Found in tests/Settings/Groups.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 '43', column '25').
    Open

            $modulesFromDb = (new \App\Db\Query())->from('vtiger_group2modules')->select(['tabid'])->where(['groupid' => self::$id])->column();
    Severity: Minor
    Found in tests/Settings/Groups.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 '94', column '27').
    Open

            $this->assertFalse((new \App\Db\Query())->from('vtiger_group2rs')->where(['groupid' => self::$id])->exists(), 'Record in the database should not exist');
    Severity: Minor
    Found in tests/Settings/Groups.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 '93', column '27').
    Open

            $this->assertFalse((new \App\Db\Query())->from('vtiger_group2grouprel')->where(['groupid' => self::$id])->exists(), 'Record in the database should not exist');
    Severity: Minor
    Found in tests/Settings/Groups.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 '87', column '23').
    Open

            $users2Group = (new \App\Db\Query())->from('vtiger_users2group')->select(['userid'])
    Severity: Minor
    Found in tests/Settings/Groups.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 '50', column '26').
    Open

            $group2Grouprel = (new \App\Db\Query())->from('vtiger_group2grouprel')->select(['containsgroupid'])->where(['groupid' => self::$id])->column();
    Severity: Minor
    Found in tests/Settings/Groups.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 '82', column '25').
    Open

            $modulesFromDb = (new \App\Db\Query())->from('vtiger_group2modules')->select(['tabid'])
    Severity: Minor
    Found in tests/Settings/Groups.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 '58', column '22').
    Open

            $group2Role = (new \App\Db\Query())->from('vtiger_group2role')->select(['roleid'])->where(['groupid' => self::$id])->column();
    Severity: Minor
    Found in tests/Settings/Groups.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 '95', column '27').
    Open

            $this->assertFalse((new \App\Db\Query())->from('vtiger_group2role')->where(['groupid' => self::$id])->exists(), 'Record in the database should not exist');
    Severity: Minor
    Found in tests/Settings/Groups.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 '37', column '15').
    Open

            $row = (new \App\Db\Query())->from('vtiger_groups')->where(['groupid' => self::$id])->one();
    Severity: Minor
    Found in tests/Settings/Groups.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 '46', column '23').
    Open

            $users2Group = (new \App\Db\Query())->from('vtiger_users2group')->select(['userid'])->where(['groupid' => self::$id])->column();
    Severity: Minor
    Found in tests/Settings/Groups.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 '112', column '27').
    Open

            $this->assertFalse((new \App\Db\Query())->from('vtiger_groups')->where(['groupid' => self::$id])->exists(), 'The record was not removed from the database ID: ' . self::$id);
    Severity: Minor
    Found in tests/Settings/Groups.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 'testDeleteGroups'.
    Open

            $recordModel = \Settings_Groups_Record_Model::getInstance(self::$id);
    Severity: Minor
    Found in tests/Settings/Groups.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_Groups_Record_Model' in method 'testAddGroups'.
    Open

            $recordModel = \Settings_Groups_Record_Model::getCleanInstance();
    Severity: Minor
    Found in tests/Settings/Groups.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_Groups_Record_Model' in method 'testDeleteGroups'.
    Open

            $transferToOwner = \Settings_Groups_Record_Model::getInstance($transferRecordId);
    Severity: Minor
    Found in tests/Settings/Groups.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_Groups_Record_Model' in method 'testEditGroups'.
    Open

            $recordModel = \Settings_Groups_Record_Model::getInstance(self::$id);
    Severity: Minor
    Found in tests/Settings/Groups.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 'testDeleteGroups'.
    Open

                $transferToOwner = \Users_Record_Model::getInstanceById($transferRecordId, 'Users');
    Severity: Minor
    Found in tests/Settings/Groups.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

    Define a constant instead of duplicating this literal "members" 4 times.
    Open

            $recordModel->set('members', $recordModel->getFieldInstanceByName('members')->getDBValue(['Users:1', 'Groups:2', 'Roles:H6', 'RoleAndSubordinates:H34']));
    Severity: Critical
    Found in tests/Settings/Groups.php by sonar-php

    Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

    On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

    Noncompliant Code Example

    With the default threshold of 3:

    function run() {
      prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
      execute('action1');
      release('action1');
    }
    

    Compliant Solution

    ACTION_1 = 'action1';
    
    function run() {
      prepare(ACTION_1);
      execute(ACTION_1);
      release(ACTION_1);
    }
    

    Exceptions

    To prevent generating some false-positives, literals having less than 5 characters are excluded.

    Define a constant instead of duplicating this literal "vtiger_groups" 3 times.
    Open

            $row = (new \App\Db\Query())->from('vtiger_groups')->where(['groupid' => self::$id])->one();
    Severity: Critical
    Found in tests/Settings/Groups.php by sonar-php

    Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

    On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

    Noncompliant Code Example

    With the default threshold of 3:

    function run() {
      prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
      execute('action1');
      release('action1');
    }
    

    Compliant Solution

    ACTION_1 = 'action1';
    
    function run() {
      prepare(ACTION_1);
      execute(ACTION_1);
      release(ACTION_1);
    }
    

    Exceptions

    To prevent generating some false-positives, literals having less than 5 characters are excluded.

    Define a constant instead of duplicating this literal "description" 4 times.
    Open

            $recordModel->set('description', 'Test description');
    Severity: Critical
    Found in tests/Settings/Groups.php by sonar-php

    Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

    On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

    Noncompliant Code Example

    With the default threshold of 3:

    function run() {
      prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
      execute('action1');
      release('action1');
    }
    

    Compliant Solution

    ACTION_1 = 'action1';
    
    function run() {
      prepare(ACTION_1);
      execute(ACTION_1);
      release(ACTION_1);
    }
    

    Exceptions

    To prevent generating some false-positives, literals having less than 5 characters are excluded.

    Define a constant instead of duplicating this literal "groupid" 13 times.
    Open

            $row = (new \App\Db\Query())->from('vtiger_groups')->where(['groupid' => self::$id])->one();
    Severity: Critical
    Found in tests/Settings/Groups.php by sonar-php

    Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

    On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

    Noncompliant Code Example

    With the default threshold of 3:

    function run() {
      prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
      execute('action1');
      release('action1');
    }
    

    Compliant Solution

    ACTION_1 = 'action1';
    
    function run() {
      prepare(ACTION_1);
      execute(ACTION_1);
      release(ACTION_1);
    }
    

    Exceptions

    To prevent generating some false-positives, literals having less than 5 characters are excluded.

    Define a constant instead of duplicating this literal "groupname" 4 times.
    Open

            $recordModel->set('groupname', 'Test groups');
    Severity: Critical
    Found in tests/Settings/Groups.php by sonar-php

    Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

    On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

    Noncompliant Code Example

    With the default threshold of 3:

    function run() {
      prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
      execute('action1');
      release('action1');
    }
    

    Compliant Solution

    ACTION_1 = 'action1';
    
    function run() {
      prepare(ACTION_1);
      execute(ACTION_1);
      release(ACTION_1);
    }
    

    Exceptions

    To prevent generating some false-positives, literals having less than 5 characters are excluded.

    Define a constant instead of duplicating this literal "Record in the database should not exist" 3 times.
    Open

            $this->assertFalse((new \App\Db\Query())->from('vtiger_group2grouprel')->where(['groupid' => self::$id])->exists(), 'Record in the database should not exist');
    Severity: Critical
    Found in tests/Settings/Groups.php by sonar-php

    Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

    On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

    Noncompliant Code Example

    With the default threshold of 3:

    function run() {
      prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
      execute('action1');
      release('action1');
    }
    

    Compliant Solution

    ACTION_1 = 'action1';
    
    function run() {
      prepare(ACTION_1);
      execute(ACTION_1);
      release(ACTION_1);
    }
    

    Exceptions

    To prevent generating some false-positives, literals having less than 5 characters are excluded.

    Define a constant instead of duplicating this literal "modules" 4 times.
    Open

            $recordModel->set('modules', $recordModel->getFieldInstanceByName('modules')->getDBValue($modules));
    Severity: Critical
    Found in tests/Settings/Groups.php by sonar-php

    Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

    On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

    Noncompliant Code Example

    With the default threshold of 3:

    function run() {
      prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
      execute('action1');
      release('action1');
    }
    

    Compliant Solution

    ACTION_1 = 'action1';
    
    function run() {
      prepare(ACTION_1);
      execute(ACTION_1);
      release(ACTION_1);
    }
    

    Exceptions

    To prevent generating some false-positives, literals having less than 5 characters are excluded.

    Call to undeclared method \Tests\Settings\Groups::assertSame
    Open

            $this->assertSame($row['description'], 'Test description edit');
    Severity: Critical
    Found in tests/Settings/Groups.php by phan

    Call to undeclared method \Tests\Settings\Groups::assertFalse
    Open

            $this->assertFalse((new \App\Db\Query())->from('vtiger_group2rs')->where(['groupid' => self::$id])->exists(), 'Record in the database should not exist');
    Severity: Critical
    Found in tests/Settings/Groups.php by phan

    Call to undeclared method \Tests\Settings\Groups::assertSame
    Open

            $this->assertSame($users2Group[0], 1);
    Severity: Critical
    Found in tests/Settings/Groups.php by phan

    Call to undeclared method \Tests\Settings\Groups::assertCount
    Open

            $this->assertCount(0, array_diff($modules, $modulesFromDb));
    Severity: Critical
    Found in tests/Settings/Groups.php by phan

    Call to undeclared method \Tests\Settings\Groups::assertIsInt
    Open

            $this->assertIsInt(self::$id);
    Severity: Critical
    Found in tests/Settings/Groups.php by phan

    Call to undeclared method \Tests\Settings\Groups::assertCount
    Open

            $this->assertCount(1, $group2Grouprel);
    Severity: Critical
    Found in tests/Settings/Groups.php by phan

    Call to undeclared method \App\Db\Query::from
    Open

            $row = (new \App\Db\Query())->from('vtiger_groups')->where(['groupid' => self::$id])->one();
    Severity: Critical
    Found in tests/Settings/Groups.php by phan

    Call to undeclared method \Tests\Settings\Groups::assertCount
    Open

            $this->assertCount(1, $users2Group);
    Severity: Critical
    Found in tests/Settings/Groups.php by phan

    Call to undeclared method \Tests\Settings\Groups::assertFalse
    Open

            $this->assertFalse((new \App\Db\Query())->from('vtiger_group2grouprel')->where(['groupid' => self::$id])->exists(), 'Record in the database should not exist');
    Severity: Critical
    Found in tests/Settings/Groups.php by phan

    Call to undeclared method \Tests\Settings\Groups::assertFalse
    Open

            $this->assertFalse((new \App\Db\Query())->from('vtiger_groups')->where(['groupid' => self::$id])->exists(), 'The record was not removed from the database ID: ' . self::$id);
    Severity: Critical
    Found in tests/Settings/Groups.php by phan

    Call to undeclared method \Tests\Settings\Groups::assertSame
    Open

            $this->assertSame($group2Rs[0], 'H34');
    Severity: Critical
    Found in tests/Settings/Groups.php by phan

    Call to undeclared method \Tests\Settings\Groups::assertCount
    Open

            $this->assertCount(1, $group2Role);
    Severity: Critical
    Found in tests/Settings/Groups.php by phan

    Call to undeclared method \Tests\Settings\Groups::assertNotFalse
    Open

            $this->assertNotFalse($row, 'No record id: ' . self::$id);
    Severity: Critical
    Found in tests/Settings/Groups.php by phan

    Call to undeclared method \App\Db\Query::from
    Open

            $modulesFromDb = (new \App\Db\Query())->from('vtiger_group2modules')->select(['tabid'])->where(['groupid' => self::$id])->column();
    Severity: Critical
    Found in tests/Settings/Groups.php by phan

    Call to undeclared method \App\Db\Query::from
    Open

            $users2Group = (new \App\Db\Query())->from('vtiger_users2group')->select(['userid'])->where(['groupid' => self::$id])->column();
    Severity: Critical
    Found in tests/Settings/Groups.php by phan

    Argument 1 (value) is array{0:'Users:1'} but \Vtiger_Field_Model::getDBValue() takes \type defined at /code/modules/Vtiger/models/Field.php:1357
    Open

            $recordModel->set('members', $recordModel->getFieldInstanceByName('members')->getDBValue(['Users:1']));
    Severity: Minor
    Found in tests/Settings/Groups.php by phan

    Call to undeclared method \App\Db\Query::from
    Open

            $modulesFromDb = (new \App\Db\Query())->from('vtiger_group2modules')->select(['tabid'])
    Severity: Critical
    Found in tests/Settings/Groups.php by phan

    Call to undeclared method \Tests\Settings\Groups::assertCount
    Open

            $this->assertCount(0, array_diff($modules, $modulesFromDb));
    Severity: Critical
    Found in tests/Settings/Groups.php by phan

    Call to undeclared method \App\Db\Query::from
    Open

            $users2Group = (new \App\Db\Query())->from('vtiger_users2group')->select(['userid'])
    Severity: Critical
    Found in tests/Settings/Groups.php by phan

    Call to undeclared method \App\Db\Query::from
    Open

            $this->assertFalse((new \App\Db\Query())->from('vtiger_group2rs')->where(['groupid' => self::$id])->exists(), 'Record in the database should not exist');
    Severity: Critical
    Found in tests/Settings/Groups.php by phan

    Call to undeclared method \App\Db\Query::from
    Open

            $row = (new \App\Db\Query())->from('vtiger_groups')->where(['groupid' => self::$id])->one();
    Severity: Critical
    Found in tests/Settings/Groups.php by phan

    Call to undeclared method \Tests\Settings\Groups::assertCount
    Open

            $this->assertCount(1, $users2Group);
    Severity: Critical
    Found in tests/Settings/Groups.php by phan

    Argument 1 (value) is array{0:'7'} but \Vtiger_Field_Model::getDBValue() takes \type defined at /code/modules/Vtiger/models/Field.php:1357
    Open

            $recordModel->set('modules', $recordModel->getFieldInstanceByName('modules')->getDBValue($modules));
    Severity: Minor
    Found in tests/Settings/Groups.php by phan

    Call to undeclared method \Tests\Settings\Groups::assertSame
    Open

            $this->assertSame($row['groupname'], 'Test groups edit');
    Severity: Critical
    Found in tests/Settings/Groups.php by phan

    Call to undeclared method \Tests\Settings\Groups::assertSame
    Open

            $this->assertSame($row['groupname'], 'Test groups');
    Severity: Critical
    Found in tests/Settings/Groups.php by phan

    Call to undeclared method \Tests\Settings\Groups::assertSame
    Open

            $this->assertSame($group2Grouprel[0], 2);
    Severity: Critical
    Found in tests/Settings/Groups.php by phan

    Call to undeclared method \App\Db\Query::from
    Open

            $group2Role = (new \App\Db\Query())->from('vtiger_group2role')->select(['roleid'])->where(['groupid' => self::$id])->column();
    Severity: Critical
    Found in tests/Settings/Groups.php by phan

    Call to undeclared method \App\Db\Query::from
    Open

            $this->assertFalse((new \App\Db\Query())->from('vtiger_group2role')->where(['groupid' => self::$id])->exists(), 'Record in the database should not exist');
    Severity: Critical
    Found in tests/Settings/Groups.php by phan

    Call to undeclared method \App\Db\Query::from
    Open

            $this->assertFalse((new \App\Db\Query())->from('vtiger_groups')->where(['groupid' => self::$id])->exists(), 'The record was not removed from the database ID: ' . self::$id);
    Severity: Critical
    Found in tests/Settings/Groups.php by phan

    Call to undeclared method \Tests\Settings\Groups::assertSame
    Open

            $this->assertSame($users2Group[0], 1);
    Severity: Critical
    Found in tests/Settings/Groups.php by phan

    Call to undeclared method \Tests\Settings\Groups::assertFalse
    Open

            $this->assertFalse((new \App\Db\Query())->from('vtiger_group2role')->where(['groupid' => self::$id])->exists(), 'Record in the database should not exist');
    Severity: Critical
    Found in tests/Settings/Groups.php by phan

    Call to undeclared method \App\Db\Query::from
    Open

            $group2Grouprel = (new \App\Db\Query())->from('vtiger_group2grouprel')->select(['containsgroupid'])->where(['groupid' => self::$id])->column();
    Severity: Critical
    Found in tests/Settings/Groups.php by phan

    Call to undeclared method \App\Db\Query::from
    Open

            $group2Rs = (new \App\Db\Query())->from('vtiger_group2rs')->select(['roleandsubid'])->where(['groupid' => self::$id])->column();
    Severity: Critical
    Found in tests/Settings/Groups.php by phan

    Call to undeclared method \Tests\Settings\Groups::assertCount
    Open

            $this->assertCount(1, $group2Rs);
    Severity: Critical
    Found in tests/Settings/Groups.php by phan

    Call to undeclared method \Tests\Settings\Groups::assertSame
    Open

            $this->assertSame($group2Role[0], 'H6');
    Severity: Critical
    Found in tests/Settings/Groups.php by phan

    Call to undeclared method \Tests\Settings\Groups::assertSame
    Open

            $this->assertSame($row['description'], 'Test description');
    Severity: Critical
    Found in tests/Settings/Groups.php by phan

    Call to undeclared method \App\Db\Query::from
    Open

            $this->assertFalse((new \App\Db\Query())->from('vtiger_group2grouprel')->where(['groupid' => self::$id])->exists(), 'Record in the database should not exist');
    Severity: Critical
    Found in tests/Settings/Groups.php by phan

    Avoid variables with short names like $id. Configured minimum length is 3.
    Open

        private static $id;
    Severity: Minor
    Found in tests/Settings/Groups.php by phpmd

    ShortVariable

    Since: 0.2

    Detects when a field, local, or parameter has a very short name.

    Example

    class Something {
        private $q = 15; // VIOLATION - Field
        public static function main( array $as ) { // VIOLATION - Formal
            $r = 20 + $this->q; // VIOLATION - Local
            for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                $r += $this->q;
            }
        }
    }

    Source https://phpmd.org/rules/naming.html#shortvariable

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

        /**
    Severity: Minor
    Found in tests/Settings/Groups.php by phpcodesniffer

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

            $recordModel = \Settings_Groups_Record_Model::getCleanInstance();
    Severity: Minor
    Found in tests/Settings/Groups.php by phpcodesniffer

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

         * Group id.
    Severity: Minor
    Found in tests/Settings/Groups.php by phpcodesniffer

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

        {
    Severity: Minor
    Found in tests/Settings/Groups.php by phpcodesniffer

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

            $recordModel->save();
    Severity: Minor
    Found in tests/Settings/Groups.php by phpcodesniffer

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

            $row = (new \App\Db\Query())->from('vtiger_groups')->where(['groupid' => self::$id])->one();
    Severity: Minor
    Found in tests/Settings/Groups.php by phpcodesniffer

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

            $this->assertSame($row['description'], 'Test description');
    Severity: Minor
    Found in tests/Settings/Groups.php by phpcodesniffer

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

            $modulesFromDb = (new \App\Db\Query())->from('vtiger_group2modules')->select(['tabid'])->where(['groupid' => self::$id])->column();
    Severity: Minor
    Found in tests/Settings/Groups.php by phpcodesniffer

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

        public function testAddGroups()
    Severity: Minor
    Found in tests/Settings/Groups.php by phpcodesniffer

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

            $this->assertNotFalse($row, 'No record id: ' . self::$id);
    Severity: Minor
    Found in tests/Settings/Groups.php by phpcodesniffer

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

            $this->assertSame($row['groupname'], 'Test groups');
    Severity: Minor
    Found in tests/Settings/Groups.php by phpcodesniffer

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

         */
    Severity: Minor
    Found in tests/Settings/Groups.php by phpcodesniffer

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

            $recordModel->set('members', $recordModel->getFieldInstanceByName('members')->getDBValue(['Users:1', 'Groups:2', 'Roles:H6', 'RoleAndSubordinates:H34']));
    Severity: Minor
    Found in tests/Settings/Groups.php by phpcodesniffer

    Line exceeds 120 characters; contains 139 characters
    Open

            $modulesFromDb = (new \App\Db\Query())->from('vtiger_group2modules')->select(['tabid'])->where(['groupid' => self::$id])->column();
    Severity: Minor
    Found in tests/Settings/Groups.php by phpcodesniffer

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

         */
    Severity: Minor
    Found in tests/Settings/Groups.php by phpcodesniffer

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

         * Testing groups creation.
    Severity: Minor
    Found in tests/Settings/Groups.php by phpcodesniffer

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

            $recordModel->set('groupname', 'Test groups');
    Severity: Minor
    Found in tests/Settings/Groups.php by phpcodesniffer

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

            $recordModel->set('description', 'Test description');
    Severity: Minor
    Found in tests/Settings/Groups.php by phpcodesniffer

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

            $this->assertIsInt(self::$id);
    Severity: Minor
    Found in tests/Settings/Groups.php by phpcodesniffer

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

        private static $id;
    Severity: Minor
    Found in tests/Settings/Groups.php by phpcodesniffer

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

            self::$id = $recordModel->getId();
    Severity: Minor
    Found in tests/Settings/Groups.php by phpcodesniffer

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

        /**
    Severity: Minor
    Found in tests/Settings/Groups.php by phpcodesniffer

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

            $modules = ['4', '7'];
    Severity: Minor
    Found in tests/Settings/Groups.php by phpcodesniffer

    Line exceeds 120 characters; contains 162 characters
    Open

            $recordModel->set('members', $recordModel->getFieldInstanceByName('members')->getDBValue(['Users:1', 'Groups:2', 'Roles:H6', 'RoleAndSubordinates:H34']));
    Severity: Minor
    Found in tests/Settings/Groups.php by phpcodesniffer

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

            $recordModel->set('modules', $recordModel->getFieldInstanceByName('modules')->getDBValue($modules));
    Severity: Minor
    Found in tests/Settings/Groups.php by phpcodesniffer

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

            $this->assertCount(0, array_diff($modules, $modulesFromDb));
    Severity: Minor
    Found in tests/Settings/Groups.php by phpcodesniffer

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

            $users2Group = (new \App\Db\Query())->from('vtiger_users2group')->select(['userid'])->where(['groupid' => self::$id])->column();
    Severity: Minor
    Found in tests/Settings/Groups.php by phpcodesniffer

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

            $group2Grouprel = (new \App\Db\Query())->from('vtiger_group2grouprel')->select(['containsgroupid'])->where(['groupid' => self::$id])->column();
    Severity: Minor
    Found in tests/Settings/Groups.php by phpcodesniffer

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

         */
    Severity: Minor
    Found in tests/Settings/Groups.php by phpcodesniffer

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

            $this->assertSame($row['groupname'], 'Test groups edit');
    Severity: Minor
    Found in tests/Settings/Groups.php by phpcodesniffer

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

        }
    Severity: Minor
    Found in tests/Settings/Groups.php by phpcodesniffer

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

        /**
    Severity: Minor
    Found in tests/Settings/Groups.php by phpcodesniffer

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

            $this->assertSame($users2Group[0], 1);
    Severity: Minor
    Found in tests/Settings/Groups.php by phpcodesniffer

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

            $this->assertSame($group2Role[0], 'H6');
    Severity: Minor
    Found in tests/Settings/Groups.php by phpcodesniffer

    Line exceeds 120 characters; contains 181 characters
    Open

            $this->assertFalse((new \App\Db\Query())->from('vtiger_groups')->where(['groupid' => self::$id])->exists(), 'The record was not removed from the database ID: ' . self::$id);
    Severity: Minor
    Found in tests/Settings/Groups.php by phpcodesniffer

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

            $this->assertCount(1, $group2Role);
    Severity: Minor
    Found in tests/Settings/Groups.php by phpcodesniffer

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

        public function testEditGroups()
    Severity: Minor
    Found in tests/Settings/Groups.php by phpcodesniffer

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

            $recordModel->set('description', 'Test description edit');
    Severity: Minor
    Found in tests/Settings/Groups.php by phpcodesniffer

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

            $this->assertFalse((new \App\Db\Query())->from('vtiger_group2grouprel')->where(['groupid' => self::$id])->exists(), 'Record in the database should not exist');
    Severity: Minor
    Found in tests/Settings/Groups.php by phpcodesniffer

    Line exceeds 120 characters; contains 161 characters
    Open

            $this->assertFalse((new \App\Db\Query())->from('vtiger_group2rs')->where(['groupid' => self::$id])->exists(), 'Record in the database should not exist');
    Severity: Minor
    Found in tests/Settings/Groups.php by phpcodesniffer

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

        public function testDeleteGroups()
    Severity: Minor
    Found in tests/Settings/Groups.php by phpcodesniffer

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

                $transferToOwner = \Users_Record_Model::getInstanceById($transferRecordId, 'Users');
    Severity: Minor
    Found in tests/Settings/Groups.php by phpcodesniffer

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

            $recordModel->save();
    Severity: Minor
    Found in tests/Settings/Groups.php by phpcodesniffer

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

            $this->assertCount(0, array_diff($modules, $modulesFromDb));
    Severity: Minor
    Found in tests/Settings/Groups.php by phpcodesniffer

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

            $this->assertCount(1, $users2Group);
    Severity: Minor
    Found in tests/Settings/Groups.php by phpcodesniffer

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

            $this->assertFalse((new \App\Db\Query())->from('vtiger_group2rs')->where(['groupid' => self::$id])->exists(), 'Record in the database should not exist');
    Severity: Minor
    Found in tests/Settings/Groups.php by phpcodesniffer

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

            $this->assertFalse((new \App\Db\Query())->from('vtiger_group2role')->where(['groupid' => self::$id])->exists(), 'Record in the database should not exist');
    Severity: Minor
    Found in tests/Settings/Groups.php by phpcodesniffer

    Line exceeds 120 characters; contains 151 characters
    Open

            $group2Grouprel = (new \App\Db\Query())->from('vtiger_group2grouprel')->select(['containsgroupid'])->where(['groupid' => self::$id])->column();
    Severity: Minor
    Found in tests/Settings/Groups.php by phpcodesniffer

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

            $this->assertSame($group2Grouprel[0], 2);
    Severity: Minor
    Found in tests/Settings/Groups.php by phpcodesniffer

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

         * Testing groups edit.
    Severity: Minor
    Found in tests/Settings/Groups.php by phpcodesniffer

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

            $this->assertSame($row['description'], 'Test description edit');
    Severity: Minor
    Found in tests/Settings/Groups.php by phpcodesniffer

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

            $transferRecordId = 1;
    Severity: Minor
    Found in tests/Settings/Groups.php by phpcodesniffer

    Line exceeds 120 characters; contains 136 characters
    Open

            $users2Group = (new \App\Db\Query())->from('vtiger_users2group')->select(['userid'])->where(['groupid' => self::$id])->column();
    Severity: Minor
    Found in tests/Settings/Groups.php by phpcodesniffer

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

            $modules = ['7'];
    Severity: Minor
    Found in tests/Settings/Groups.php by phpcodesniffer

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

        }
    Severity: Minor
    Found in tests/Settings/Groups.php by phpcodesniffer

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

        {
    Severity: Minor
    Found in tests/Settings/Groups.php by phpcodesniffer

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

            $this->assertCount(1, $users2Group);
    Severity: Minor
    Found in tests/Settings/Groups.php by phpcodesniffer

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

         * Testing group deletion.
    Severity: Minor
    Found in tests/Settings/Groups.php by phpcodesniffer

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

            $group2Role = (new \App\Db\Query())->from('vtiger_group2role')->select(['roleid'])->where(['groupid' => self::$id])->column();
    Severity: Minor
    Found in tests/Settings/Groups.php by phpcodesniffer

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

            $recordModel->set('members', $recordModel->getFieldInstanceByName('members')->getDBValue(['Users:1']));
    Severity: Minor
    Found in tests/Settings/Groups.php by phpcodesniffer

    Line exceeds 120 characters; contains 163 characters
    Open

            $this->assertFalse((new \App\Db\Query())->from('vtiger_group2role')->where(['groupid' => self::$id])->exists(), 'Record in the database should not exist');
    Severity: Minor
    Found in tests/Settings/Groups.php by phpcodesniffer

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

            }
    Severity: Minor
    Found in tests/Settings/Groups.php by phpcodesniffer

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

            $recordModel->delete($transferToOwner);
    Severity: Minor
    Found in tests/Settings/Groups.php by phpcodesniffer

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

            $modulesFromDb = (new \App\Db\Query())->from('vtiger_group2modules')->select(['tabid'])
    Severity: Minor
    Found in tests/Settings/Groups.php by phpcodesniffer

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

            $this->assertFalse((new \App\Db\Query())->from('vtiger_groups')->where(['groupid' => self::$id])->exists(), 'The record was not removed from the database ID: ' . self::$id);
    Severity: Minor
    Found in tests/Settings/Groups.php by phpcodesniffer

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

            $group2Rs = (new \App\Db\Query())->from('vtiger_group2rs')->select(['roleandsubid'])->where(['groupid' => self::$id])->column();
    Severity: Minor
    Found in tests/Settings/Groups.php by phpcodesniffer

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

            $this->assertSame($group2Rs[0], 'H34');
    Severity: Minor
    Found in tests/Settings/Groups.php by phpcodesniffer

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

                ->where(['groupid' => self::$id])->column();
    Severity: Minor
    Found in tests/Settings/Groups.php by phpcodesniffer

    Line exceeds 120 characters; contains 136 characters
    Open

            $group2Rs = (new \App\Db\Query())->from('vtiger_group2rs')->select(['roleandsubid'])->where(['groupid' => self::$id])->column();
    Severity: Minor
    Found in tests/Settings/Groups.php by phpcodesniffer

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

        }
    Severity: Minor
    Found in tests/Settings/Groups.php by phpcodesniffer

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

                ->where(['groupid' => self::$id])->column();
    Severity: Minor
    Found in tests/Settings/Groups.php by phpcodesniffer

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

            if (!$transferToOwner) {
    Severity: Minor
    Found in tests/Settings/Groups.php by phpcodesniffer

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

            $this->assertCount(1, $group2Grouprel);
    Severity: Minor
    Found in tests/Settings/Groups.php by phpcodesniffer

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

            $recordModel->set('modules', $recordModel->getFieldInstanceByName('modules')->getDBValue($modules));
    Severity: Minor
    Found in tests/Settings/Groups.php by phpcodesniffer

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

            $users2Group = (new \App\Db\Query())->from('vtiger_users2group')->select(['userid'])
    Severity: Minor
    Found in tests/Settings/Groups.php by phpcodesniffer

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

        {
    Severity: Minor
    Found in tests/Settings/Groups.php by phpcodesniffer

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

            $recordModel = \Settings_Groups_Record_Model::getInstance(self::$id);
    Severity: Minor
    Found in tests/Settings/Groups.php by phpcodesniffer

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

            $this->assertCount(1, $group2Rs);
    Severity: Minor
    Found in tests/Settings/Groups.php by phpcodesniffer

    Line exceeds 120 characters; contains 134 characters
    Open

            $group2Role = (new \App\Db\Query())->from('vtiger_group2role')->select(['roleid'])->where(['groupid' => self::$id])->column();
    Severity: Minor
    Found in tests/Settings/Groups.php by phpcodesniffer

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

            $recordModel = \Settings_Groups_Record_Model::getInstance(self::$id);
    Severity: Minor
    Found in tests/Settings/Groups.php by phpcodesniffer

    Line exceeds 120 characters; contains 167 characters
    Open

            $this->assertFalse((new \App\Db\Query())->from('vtiger_group2grouprel')->where(['groupid' => self::$id])->exists(), 'Record in the database should not exist');
    Severity: Minor
    Found in tests/Settings/Groups.php by phpcodesniffer

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

         */
    Severity: Minor
    Found in tests/Settings/Groups.php by phpcodesniffer

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

            $transferToOwner = \Settings_Groups_Record_Model::getInstance($transferRecordId);
    Severity: Minor
    Found in tests/Settings/Groups.php by phpcodesniffer

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

        /**
    Severity: Minor
    Found in tests/Settings/Groups.php by phpcodesniffer

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

            $recordModel->set('groupname', 'Test groups edit');
    Severity: Minor
    Found in tests/Settings/Groups.php by phpcodesniffer

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

            $row = (new \App\Db\Query())->from('vtiger_groups')->where(['groupid' => self::$id])->one();
    Severity: Minor
    Found in tests/Settings/Groups.php by phpcodesniffer

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

            $this->assertSame($users2Group[0], 1);
    Severity: Minor
    Found in tests/Settings/Groups.php by phpcodesniffer

    There are no issues that match your filters.

    Category
    Status