YetiForceCompany/YetiForceCRM

View on GitHub
tests/Settings/ModuleManager.php

Summary

Maintainability
C
1 day
Test Coverage
A
100%

The class ModuleManager has 12 public methods. Consider refactoring ModuleManager to keep number of public methods under 10.
Open

class ModuleManager extends \Tests\Base
{
    /**
     * Zip file name.
     *
Severity: Minor
Found in tests/Settings/ModuleManager.php by phpmd

TooManyPublicMethods

Since: 0.1

A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

By default it ignores methods starting with 'get' or 'set'.

Example

Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

File ModuleManager.php has 300 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * ModuleManager test class.
 *
 * @package   Tests
Severity: Minor
Found in tests/Settings/ModuleManager.php - About 3 hrs to fix

    Method testCreateNewField has 74 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function testCreateNewField($type, $param, $suffix = '')
        {
            $key = $type . $suffix;
            $param['fieldType'] = $type;
            $param['fieldLabel'] = $type . 'FL' . $suffix;
    Severity: Major
    Found in tests/Settings/ModuleManager.php - About 2 hrs to fix

      Function testCreateNewField has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          public function testCreateNewField($type, $param, $suffix = '')
          {
              $key = $type . $suffix;
              $param['fieldType'] = $type;
              $param['fieldLabel'] = $type . 'FL' . $suffix;
      Severity: Minor
      Found in tests/Settings/ModuleManager.php - About 1 hr to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Method testDeleteNewField has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function testDeleteNewField($type, $param, $suffix = '')
          {
              $key = $type . $suffix;
              $fieldInstance = \Settings_LayoutEditor_Field_Model::getInstance(self::$fieldsId[$key]);
              $uitype = $fieldInstance->getUIType();
      Severity: Minor
      Found in tests/Settings/ModuleManager.php - About 1 hr to fix

        Function testDeleteNewField has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            public function testDeleteNewField($type, $param, $suffix = '')
            {
                $key = $type . $suffix;
                $fieldInstance = \Settings_LayoutEditor_Field_Model::getInstance(self::$fieldsId[$key]);
                $uitype = $fieldInstance->getUIType();
        Severity: Minor
        Found in tests/Settings/ModuleManager.php - About 35 mins to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        The method testCreateNewField() has a Cyclomatic Complexity of 11. The configured cyclomatic complexity threshold is 10.
        Open

            public function testCreateNewField($type, $param, $suffix = '')
            {
                $key = $type . $suffix;
                $param['fieldType'] = $type;
                $param['fieldLabel'] = $type . 'FL' . $suffix;
        Severity: Minor
        Found in tests/Settings/ModuleManager.php by phpmd

        CyclomaticComplexity

        Since: 0.1

        Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

        Example

        // Cyclomatic Complexity = 11
        class Foo {
        1   public function example() {
        2       if ($a == $b) {
        3           if ($a1 == $b1) {
                        fiddle();
        4           } elseif ($a2 == $b2) {
                        fiddle();
                    } else {
                        fiddle();
                    }
        5       } elseif ($c == $d) {
        6           while ($c == $d) {
                        fiddle();
                    }
        7        } elseif ($e == $f) {
        8           for ($n = 0; $n < $h; $n++) {
                        fiddle();
                    }
                } else {
                    switch ($z) {
        9               case 1:
                            fiddle();
                            break;
        10              case 2:
                            fiddle();
                            break;
        11              case 3:
                            fiddle();
                            break;
                        default:
                            fiddle();
                            break;
                    }
                }
            }
        }

        Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

        The class ModuleManager has a coupling between objects value of 20. Consider to reduce the number of dependencies under 13.
        Open

        class ModuleManager extends \Tests\Base
        {
            /**
             * Zip file name.
             *
        Severity: Minor
        Found in tests/Settings/ModuleManager.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 '325', column '29').
        Open

                        $this->assertFalse((new \App\Db\Query())->from('s_#__multireference')->where(['source_module' => 'TestModule', 'dest_module' => 'Contacts'])->exists(), 'The record from "s_#__multireference" was not removed.');
        Severity: Minor
        Found in tests/Settings/ModuleManager.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 '352', column '24').
        Open

                $packageExport = new \vtlib\PackageExport();
        Severity: Minor
        Found in tests/Settings/ModuleManager.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 '98', column '21').
        Open

                $rowModule = (new \App\Db\Query())->from('vtiger_tab')->where(['name' => 'TestModule'])->one();
        Severity: Minor
        Found in tests/Settings/ModuleManager.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 '177', column '27').
        Open

                $this->assertCount((new \App\Db\Query())->from('vtiger_profile2field')->where(['fieldid' => self::$fieldsId[$key]])->count(), $profilesId, "The field \"$type\" did not add correctly to the profiles");
        Severity: Minor
        Found in tests/Settings/ModuleManager.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 '128', column '24').
        Open

                $blockInstance = new \Settings_LayoutEditor_Block_Model();
        Severity: Minor
        Found in tests/Settings/ModuleManager.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 '187', column '29').
        Open

                        $this->assertCount((new \App\Db\Query())->from('vtiger_fieldmodulerel')->where(['fieldid' => self::$fieldsId[$key]])->count(), $param['referenceModule'], 'Problem with table "vtiger_fieldmodulerel" in database');
        Severity: Minor
        Found in tests/Settings/ModuleManager.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 '183', column '29').
        Open

                        $this->assertCount((new \App\Db\Query())->from('vtiger_profile2field')->where(['fieldid' => $rowExtra['fieldid']])->count(), $profilesId, "The \"extra\" field \"$type\" did not add correctly to the profiles");
        Severity: Minor
        Found in tests/Settings/ModuleManager.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 '216', column '11').
        Open

                            (new \App\Db\Query())->from('vtiger_role')->count() * \count($param['pickListValues']),
        Severity: Minor
        Found in tests/Settings/ModuleManager.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 '205', column '12').
        Open

                                (new \App\Db\Query())->select($param['fieldName'])->from(self::$tablesName[$key])->column()
        Severity: Minor
        Found in tests/Settings/ModuleManager.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 '319', column '11').
        Open

                            (new \App\Db\Query())->from('vtiger_picklist')->where(['name' => $columnName])->exists(),
        Severity: Minor
        Found in tests/Settings/ModuleManager.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 '217', column '11').
        Open

                            (new \App\Db\Query())->from('vtiger_role2picklist')->where(['picklistid' => $rowPicklist['picklistid']])->count(),
        Severity: Minor
        Found in tests/Settings/ModuleManager.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 '322', column '31').
        Open

                        $this->assertSame(0, (new \App\Db\Query())->from('vtiger_role2picklist')->where(['picklistid' => self::$pickList[$key]])->count(), 'All rows in the table "vtiger_role2picklist" have not been deleted');
        Severity: Minor
        Found in tests/Settings/ModuleManager.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 '392', column '9').
        Open

                    (new \App\Db\Query())->from('vtiger_trees_templates')->where(['templateid' => self::$treeId])->exists(),
        Severity: Minor
        Found in tests/Settings/ModuleManager.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 '71', column '18').
        Open

                $package = new \vtlib\LanguageExport();
        Severity: Minor
        Found in tests/Settings/ModuleManager.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 '307', column '29').
        Open

                        $this->assertFalse((new \App\Db\Query())->from('vtiger_field')->where(['fieldid' => self::$fieldsExtraId[$key]])->exists(), 'The record "extra" was not removed from the database ID: ' . self::$fieldsExtraId[$key]);
        Severity: Minor
        Found in tests/Settings/ModuleManager.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 '310', column '28').
        Open

                        $this->assertSame((new \App\Db\Query())->from('vtiger_fieldmodulerel')->where(['fieldid' => self::$fieldsId[$key]])->count(), 0, 'Problem with table "vtiger_fieldmodulerel" in database');
        Severity: Minor
        Found in tests/Settings/ModuleManager.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 '302', column '27').
        Open

                $this->assertFalse((new \App\Db\Query())->from('vtiger_field')->where(['fieldid' => self::$fieldsId[$key]])->exists(), 'The record was not removed from the database ID: ' . self::$fieldsId[$key]);
        Severity: Minor
        Found in tests/Settings/ModuleManager.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 '169', column '15').
        Open

                $row = (new \App\Db\Query())->from('vtiger_field')->where(['fieldid' => self::$fieldsId[$key], 'tabid' => $moduleModel->getId()])->one();
        Severity: Minor
        Found in tests/Settings/ModuleManager.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 '209', column '25').
        Open

                        $rowPicklist = (new \App\Db\Query())->from('vtiger_picklist')->where(['name' => $param['fieldName']])->one();
        Severity: Minor
        Found in tests/Settings/ModuleManager.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 '420', column '31').
        Open

                        $this->assertSame(1, (new \App\Db\Query())->select(['presence'])->from('vtiger_tab')->where(['tabid' => $module->getId()])->scalar());
        Severity: Minor
        Found in tests/Settings/ModuleManager.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 '133', column '15').
        Open

                $row = (new \App\Db\Query())->from('vtiger_blocks')->where(['blockid' => self::$blockId])->one();
        Severity: Minor
        Found in tests/Settings/ModuleManager.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 '181', column '22').
        Open

                        $rowExtra = (new \App\Db\Query())->from('vtiger_field')->where(['fieldname' => $param['fieldName'] . '_extra'])->one();
        Severity: Minor
        Found in tests/Settings/ModuleManager.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 '192', column '69').
        Open

                        $this->assertCount(0, array_diff($param['pickListValues'], (new \App\Db\Query())->select($param['fieldName'])->from(self::$tablesName[$key])->column()), 'Bad values in the table "' . self::$tablesName[$key] . '"');
        Severity: Minor
        Found in tests/Settings/ModuleManager.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 '222', column '28').
        Open

                        $this->assertTrue((new \App\Db\Query())->from('s_#__multireference')->where(['source_module' => 'TestModule', 'dest_module' => 'Contacts'])->exists(), 'No record in the table "s_yf_multireference" for type ' . $type);
        Severity: Minor
        Found in tests/Settings/ModuleManager.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 '429', column '29').
        Open

                $moduleManagerModel = new \Settings_ModuleManager_Module_Model();
        Severity: Minor
        Found in tests/Settings/ModuleManager.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 '388', column '9').
        Open

                    (new \App\Db\Query())->from('vtiger_tab')->where(['name' => 'TestModule'])->exists(),
        Severity: Minor
        Found in tests/Settings/ModuleManager.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 '415', column '29').
        Open

                $moduleManagerModel = new \Settings_ModuleManager_Module_Model();
        Severity: Minor
        Found in tests/Settings/ModuleManager.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 '434', column '31').
        Open

                        $this->assertSame(0, (new \App\Db\Query())->select(['presence'])->from('vtiger_tab')->where(['tabid' => $module->getId()])->scalar());
        Severity: Minor
        Found in tests/Settings/ModuleManager.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_LayoutEditor_Field_Model' in method 'testDeleteNewField'.
        Open

                $fieldInstance = \Settings_LayoutEditor_Field_Model::getInstance(self::$fieldsId[$key]);
        Severity: Minor
        Found in tests/Settings/ModuleManager.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\Language' in method 'getLangPathToFile'.
        Open

                $allLang = \App\Language::getAll();
        Severity: Minor
        Found in tests/Settings/ModuleManager.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 '\vtlib\Profile' in method 'testCreateNewField'.
        Open

                $profilesId = \vtlib\Profile::getAllIds();
        Severity: Minor
        Found in tests/Settings/ModuleManager.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_Module_Model' in method 'testCreateNewBlock'.
        Open

                $moduleModel = \Vtiger_Module_Model::getInstance('TestModule');
        Severity: Minor
        Found in tests/Settings/ModuleManager.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_Block_Model' in method 'testDeleteNewBlock'.
        Open

                $blockInstance = \Vtiger_Block_Model::getInstance(self::$blockId);
        Severity: Minor
        Found in tests/Settings/ModuleManager.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_ModuleManager_Module_Model' in method 'testCreateModule'.
        Open

                $module = \Settings_ModuleManager_Module_Model::createModule([
                    'module_name' => 'TestModule',
                    'entityfieldname' => 'testmodule',
                    'module_label' => 'TestModule',
                    'entitytype' => \Vtiger_Module_Model::ADVANCED_TYPE,
        Severity: Minor
        Found in tests/Settings/ModuleManager.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 'testCreateModule'.
        Open

                $this->assertSame('TestModule', \App\Module::getModuleName($module->getId()), 'The name of the new module is missing: ' . $module->getId());
        Severity: Minor
        Found in tests/Settings/ModuleManager.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 '\vtlib\Module' in method 'testExportModule'.
        Open

                $moduleModel = \vtlib\Module::getInstance('TestModule');
        Severity: Minor
        Found in tests/Settings/ModuleManager.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 '\vtlib\Module' in method 'getMRVField'.
        Open

                $moduleInstance = \vtlib\Module::getInstance('Contacts');
        Severity: Minor
        Found in tests/Settings/ModuleManager.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 '\vtlib\Module' in method 'getMRVField'.
        Open

                $source_Module = \vtlib\Module::getInstance('TestModule');
        Severity: Minor
        Found in tests/Settings/ModuleManager.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_Block_Model' in method 'testDeleteNewBlock'.
        Open

                $this->assertFalse(\Vtiger_Block_Model::checkFieldsExists(self::$blockId), 'Fields exists');
        Severity: Minor
        Found in tests/Settings/ModuleManager.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_ModuleManager_Module_Model' in method 'testOffAllModule'.
        Open

                $allModules = \Settings_ModuleManager_Module_Model::getAll();
        Severity: Minor
        Found in tests/Settings/ModuleManager.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_ModuleManager_Module_Model' in method 'testOnAllModule'.
        Open

                $allModules = \Settings_ModuleManager_Module_Model::getAll();
        Severity: Minor
        Found in tests/Settings/ModuleManager.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_ModuleManager_Library_Model' in method 'testDownloadLibraryModule'.
        Open

                $libraries = \Settings_ModuleManager_Library_Model::getAll();
        Severity: Minor
        Found in tests/Settings/ModuleManager.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_ModuleManager_Library_Model' in method 'testDownloadLibraryModule'.
        Open

                    $this->assertTrue(\Settings_ModuleManager_Library_Model::download($key), "The library \"{$key}\" could not be downloaded");
        Severity: Minor
        Found in tests/Settings/ModuleManager.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\Config' in method 'testDownloadLibraryModule'.
        Open

                    $mode = \App\Config::developer('MISSING_LIBRARY_DEV_MODE') ? 'developer' : \App\Version::get($library['name']);
        Severity: Minor
        Found in tests/Settings/ModuleManager.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 '\vtlib\Module' in method 'testDeleteModule'.
        Open

                $moduleInstance = \vtlib\Module::getInstance('TestModule');
        Severity: Minor
        Found in tests/Settings/ModuleManager.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\Zip' in method 'testExportModule'.
        Open

                $zip = \App\Zip::openFile(self::$zipFileName, ['checkFiles' => false]);
        Severity: Minor
        Found in tests/Settings/ModuleManager.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\Version' in method 'testDownloadLibraryModule'.
        Open

                    $mode = \App\Config::developer('MISSING_LIBRARY_DEV_MODE') ? 'developer' : \App\Version::get($library['name']);
        Severity: Minor
        Found in tests/Settings/ModuleManager.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 "fieldName" 9 times.
        Open

                $param['fieldName'] = strtolower($type . 'FL' . $suffix);
        Severity: Critical
        Found in tests/Settings/ModuleManager.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 "Table "" 4 times.
        Open

                        $this->assertNotNull(\App\Db::getInstance()->getTableSchema(self::$tablesName[$key]), 'Table "' . self::$tablesName[$key] . '" does not exist');
        Severity: Critical
        Found in tests/Settings/ModuleManager.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 "fieldTypeList" 21 times.
        Open

                    ['Text', ['fieldTypeList' => 0, 'fieldLength' => 12]],
        Severity: Critical
        Found in tests/Settings/ModuleManager.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 "/PL.zip" 4 times.
        Open

                $package->exportLanguage('pl-PL', ROOT_DIRECTORY . '/PL.zip', 'PL.zip');
        Severity: Critical
        Found in tests/Settings/ModuleManager.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 "presence" 4 times.
        Open

                    if (1 !== (int) $module->get('presence')) {
        Severity: Critical
        Found in tests/Settings/ModuleManager.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_tab" 4 times.
        Open

                $rowModule = (new \App\Db\Query())->from('vtiger_tab')->where(['name' => 'TestModule'])->one();
        Severity: Critical
        Found in tests/Settings/ModuleManager.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 "TestModule" 17 times.
        Open

                    'module_name' => 'TestModule',
        Severity: Critical
        Found in tests/Settings/ModuleManager.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 "pickListValues" 7 times.
        Open

                        $this->assertCount(0, array_diff($param['pickListValues'], (new \App\Db\Query())->select($param['fieldName'])->from(self::$tablesName[$key])->column()), 'Bad values in the table "' . self::$tablesName[$key] . '"');
        Severity: Critical
        Found in tests/Settings/ModuleManager.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 "tabid" 3 times.
        Open

                $row = (new \App\Db\Query())->from('vtiger_field')->where(['fieldid' => self::$fieldsId[$key], 'tabid' => $moduleModel->getId()])->one();
        Severity: Critical
        Found in tests/Settings/ModuleManager.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 "picklistid" 3 times.
        Open

                            (new \App\Db\Query())->from('vtiger_role2picklist')->where(['picklistid' => $rowPicklist['picklistid']])->count(),
        Severity: Critical
        Found in tests/Settings/ModuleManager.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 "fieldid" 9 times.
        Open

                $row = (new \App\Db\Query())->from('vtiger_field')->where(['fieldid' => self::$fieldsId[$key], 'tabid' => $moduleModel->getId()])->one();
        Severity: Critical
        Found in tests/Settings/ModuleManager.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_field" 4 times.
        Open

                $row = (new \App\Db\Query())->from('vtiger_field')->where(['fieldid' => self::$fieldsId[$key], 'tabid' => $moduleModel->getId()])->one();
        Severity: Critical
        Found in tests/Settings/ModuleManager.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 "TestModule.json" 3 times.
        Open

                $langFileToCheck = $this->getLangPathToFile('TestModule.json');
        Severity: Critical
        Found in tests/Settings/ModuleManager.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 "uitype" 4 times.
        Open

                $this->assertSame($row['uitype'], $details['uitype']);
        Severity: Critical
        Found in tests/Settings/ModuleManager.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 "Contacts" 5 times.
        Open

                        $this->assertTrue((new \App\Db\Query())->from('s_#__multireference')->where(['source_module' => 'TestModule', 'dest_module' => 'Contacts'])->exists(), 'No record in the table "s_yf_multireference" for type ' . $type);
        Severity: Critical
        Found in tests/Settings/ModuleManager.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 "fieldLength" 5 times.
        Open

                    ['Text', ['fieldTypeList' => 0, 'fieldLength' => 12]],
        Severity: Critical
        Found in tests/Settings/ModuleManager.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.

        Avoid unused parameters such as '$param'.
        Open

            public function testDeleteNewField($type, $param, $suffix = '')
        Severity: Minor
        Found in tests/Settings/ModuleManager.php by phpmd

        UnusedFormalParameter

        Since: 0.2

        Avoid passing parameters to methods or constructors and then not using those parameters.

        Example

        class Foo
        {
            private function bar($howdy)
            {
                // $howdy is not used
            }
        }

        Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

        Avoid unused local variables such as '$lang'.
        Open

                foreach ($allLang as $key => $lang) {
        Severity: Minor
        Found in tests/Settings/ModuleManager.php by phpmd

        UnusedLocalVariable

        Since: 0.2

        Detects when a local variable is declared and/or assigned, but not used.

        Example

        class Foo {
            public function doSomething()
            {
                $i = 5; // Unused
            }
        }

        Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

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

                $this->assertCount((new \App\Db\Query())->from('vtiger_profile2field')->where(['fieldid' => self::$fieldsId[$key]])->count(), $profilesId, "The field \"$type\" did not add correctly to the profiles");
        Severity: Critical
        Found in tests/Settings/ModuleManager.php by phan

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

                $this->assertSame($row['blocklabel'], 'label block');
        Severity: Critical
        Found in tests/Settings/ModuleManager.php by phan

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

                $row = (new \App\Db\Query())->from('vtiger_field')->where(['fieldid' => self::$fieldsId[$key], 'tabid' => $moduleModel->getId()])->one();
        Severity: Critical
        Found in tests/Settings/ModuleManager.php by phan

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

                        $rowExtra = (new \App\Db\Query())->from('vtiger_field')->where(['fieldname' => $param['fieldName'] . '_extra'])->one();
        Severity: Critical
        Found in tests/Settings/ModuleManager.php by phan

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

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

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

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

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

                        $this->assertCount((new \App\Db\Query())->from('vtiger_profile2field')->where(['fieldid' => $rowExtra['fieldid']])->count(), $profilesId, "The \"extra\" field \"$type\" did not add correctly to the profiles");
        Severity: Critical
        Found in tests/Settings/ModuleManager.php by phan

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

                $this->assertSame(2, $rowModule['premium']);
        Severity: Critical
        Found in tests/Settings/ModuleManager.php by phan

        Call to undeclared method \Tests\Settings\ModuleManager::assertTrue
        Open

                $this->assertTrue(file_exists(ROOT_DIRECTORY . '/PL.zip') && filesize(ROOT_DIRECTORY . '/PL.zip') > 0);
        Severity: Critical
        Found in tests/Settings/ModuleManager.php by phan

        Call to undeclared method \Tests\Settings\ModuleManager::assertFileExists
        Open

                $this->assertFileExists(ROOT_DIRECTORY . '/modules/TestModule/TestModule.php');
        Severity: Critical
        Found in tests/Settings/ModuleManager.php by phan

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

                $rowModule = (new \App\Db\Query())->from('vtiger_tab')->where(['name' => 'TestModule'])->one();
        Severity: Critical
        Found in tests/Settings/ModuleManager.php by phan

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

                $this->assertNotFalse($rowModule);
        Severity: Critical
        Found in tests/Settings/ModuleManager.php by phan

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

                $this->assertSame($row['fieldname'], $param['fieldName']);
        Severity: Critical
        Found in tests/Settings/ModuleManager.php by phan

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

                        $this->assertNotFalse($rowExtra, 'No "extra" record for uitype: ' . $row['uitype']);
        Severity: Critical
        Found in tests/Settings/ModuleManager.php by phan

        Call to undeclared method \Tests\Settings\ModuleManager::assertFileExists
        Open

                    $this->assertFileExists($pathToFile);
        Severity: Critical
        Found in tests/Settings/ModuleManager.php by phan

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

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

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

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

        @throws type of getLangPathToFile has undeclared type \Tests\Settings\Exception (Did you mean class \Exception)
        Open

            private function getLangPathToFile($fileName)
        Severity: Minor
        Found in tests/Settings/ModuleManager.php by phan

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

                        $this->assertCount((new \App\Db\Query())->from('vtiger_profile2field')->where(['fieldid' => $rowExtra['fieldid']])->count(), $profilesId, "The \"extra\" field \"$type\" did not add correctly to the profiles");
        Severity: Critical
        Found in tests/Settings/ModuleManager.php by phan

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

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

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

                $this->assertSame(\Vtiger_Module_Model::ADVANCED_TYPE, $rowModule['type']);
        Severity: Critical
        Found in tests/Settings/ModuleManager.php by phan

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

                $this->assertCount((new \App\Db\Query())->from('vtiger_profile2field')->where(['fieldid' => self::$fieldsId[$key]])->count(), $profilesId, "The field \"$type\" did not add correctly to the profiles");
        Severity: Critical
        Found in tests/Settings/ModuleManager.php by phan

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

                        $this->assertCount((new \App\Db\Query())->from('vtiger_fieldmodulerel')->where(['fieldid' => self::$fieldsId[$key]])->count(), $param['referenceModule'], 'Problem with table "vtiger_fieldmodulerel" in database');
        Severity: Critical
        Found in tests/Settings/ModuleManager.php by phan

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

                $this->assertIsInt($module->getId());
        Severity: Critical
        Found in tests/Settings/ModuleManager.php by phan

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

                $this->assertSame('TestModule', $rowModule['tablabel']);
        Severity: Critical
        Found in tests/Settings/ModuleManager.php by phan

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

                $this->assertSame('TestModule', \App\Module::getModuleName($module->getId()), 'The name of the new module is missing: ' . $module->getId());
        Severity: Critical
        Found in tests/Settings/ModuleManager.php by phan

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

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

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

                $this->assertSame($row['fieldlabel'], $param['fieldLabel']);
        Severity: Critical
        Found in tests/Settings/ModuleManager.php by phan

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

                        $this->assertFalse((new \App\Db\Query())->from('s_#__multireference')->where(['source_module' => 'TestModule', 'dest_module' => 'Contacts'])->exists(), 'The record from "s_#__multireference" was not removed.');
        Severity: Critical
        Found in tests/Settings/ModuleManager.php by phan

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

                        $this->assertCount(0, array_diff($param['pickListValues'], (new \App\Db\Query())->select($param['fieldName'])->from(self::$tablesName[$key])->column()), 'Bad values in the table "' . self::$tablesName[$key] . '"');
        Severity: Critical
        Found in tests/Settings/ModuleManager.php by phan

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

                        $this->assertTrue((new \App\Db\Query())->from('s_#__multireference')->where(['source_module' => 'TestModule', 'dest_module' => 'Contacts'])->exists(), 'No record in the table "s_yf_multireference" for type ' . $type);
        Severity: Critical
        Found in tests/Settings/ModuleManager.php by phan

        Call to undeclared method \Tests\Settings\ModuleManager::assertFileDoesNotExist
        Open

                    $this->assertFileDoesNotExist(ROOT_DIRECTORY . \DIRECTORY_SEPARATOR . $pathToFile);
        Severity: Critical
        Found in tests/Settings/ModuleManager.php by phan

        Call to undeclared method \Tests\Settings\ModuleManager::assertDoesNotMatchRegularExpression
        Open

                    $this->assertDoesNotMatchRegularExpression('/404/', $header['Status'] ?? '', $library['url'] . "/archive/$mode.zip | " . print_r($header, true));
        Severity: Critical
        Found in tests/Settings/ModuleManager.php by phan

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

                        $this->assertSame((new \App\Db\Query())->from('vtiger_fieldmodulerel')->where(['fieldid' => self::$fieldsId[$key]])->count(), 0, 'Problem with table "vtiger_fieldmodulerel" in database');
        Severity: Critical
        Found in tests/Settings/ModuleManager.php by phan

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

                        $this->assertSame(0, (new \App\Db\Query())->from('vtiger_role2picklist')->where(['picklistid' => self::$pickList[$key]])->count(), 'All rows in the table "vtiger_role2picklist" have not been deleted');
        Severity: Critical
        Found in tests/Settings/ModuleManager.php by phan

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

                        $this->assertCount((new \App\Db\Query())->from('vtiger_fieldmodulerel')->where(['fieldid' => self::$fieldsId[$key]])->count(), $param['referenceModule'], 'Problem with table "vtiger_fieldmodulerel" in database');
        Severity: Critical
        Found in tests/Settings/ModuleManager.php by phan

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

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

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

                        $this->assertFalse(
        Severity: Critical
        Found in tests/Settings/ModuleManager.php by phan

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

                $this->assertFalse(\Vtiger_Block_Model::checkFieldsExists(self::$blockId), 'Fields exists');
        Severity: Critical
        Found in tests/Settings/ModuleManager.php by phan

        Call to undeclared method \Tests\Settings\ModuleManager::assertFileDoesNotExist
        Open

                $this->assertFileDoesNotExist(ROOT_DIRECTORY . '/modules/TestModule/TestModule.php');
        Severity: Critical
        Found in tests/Settings/ModuleManager.php by phan

        Call to undeclared method \App\Db::getTableSchema
        Open

                            \App\Db::getInstance()->getTableSchema(self::$tablesName[$key]),
        Severity: Critical
        Found in tests/Settings/ModuleManager.php by phan

        Call to undeclared method \Tests\Settings\ModuleManager::assertTrue
        Open

                $this->assertTrue($fieldInstance->isCustomField(), 'Field is not customized');
        Severity: Critical
        Found in tests/Settings/ModuleManager.php by phan

        Call to undeclared method \App\Db::getSchema
        Open

                $schema = \App\Db::getInstance()->getSchema();
        Severity: Critical
        Found in tests/Settings/ModuleManager.php by phan

        Call to undeclared method \Tests\Settings\ModuleManager::assertContains
        Open

                $this->assertContains('modules' . \DIRECTORY_SEPARATOR . 'TestModule' . \DIRECTORY_SEPARATOR . 'TestModule.php', $zipFiles);
        Severity: Critical
        Found in tests/Settings/ModuleManager.php by phan

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

                    (new \App\Db\Query())->from('vtiger_trees_templates')->where(['templateid' => self::$treeId])->exists(),
        Severity: Critical
        Found in tests/Settings/ModuleManager.php by phan

        Call to undeclared method \Tests\Settings\ModuleManager::assertFileExists
        Open

                $this->assertFileExists(self::$zipFileName);
        Severity: Critical
        Found in tests/Settings/ModuleManager.php by phan

        Call to undeclared method \Tests\Settings\ModuleManager::assertContains
        Open

                    $this->assertContains($pathToFile, $zipFiles);
        Severity: Critical
        Found in tests/Settings/ModuleManager.php by phan

        Call to undeclared method \Tests\Settings\ModuleManager::assertNotNull
        Open

                        $this->assertNotNull(\App\Db::getInstance()->getTableSchema(self::$tablesName[$key]), 'Table "' . self::$tablesName[$key] . '" does not exist');
        Severity: Critical
        Found in tests/Settings/ModuleManager.php by phan

        Call to undeclared method \App\Db::getTableSchema
        Open

                        $this->assertNotNull(\App\Db::getInstance()->getTableSchema(self::$tablesName[$key]), 'Table "' . self::$tablesName[$key] . '" does not exist');
        Severity: Critical
        Found in tests/Settings/ModuleManager.php by phan

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

                        $this->assertFalse((new \App\Db\Query())->from('vtiger_field')->where(['fieldid' => self::$fieldsExtraId[$key]])->exists(), 'The record "extra" was not removed from the database ID: ' . self::$fieldsExtraId[$key]);
        Severity: Critical
        Found in tests/Settings/ModuleManager.php by phan

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

                        $this->assertCount(0, array_diff($param['pickListValues'], (new \App\Db\Query())->select($param['fieldName'])->from(self::$tablesName[$key])->column()), 'Bad values in the table "' . self::$tablesName[$key] . '"');
        Severity: Critical
        Found in tests/Settings/ModuleManager.php by phan

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

                            (new \App\Db\Query())->from('vtiger_role2picklist')->where(['picklistid' => $rowPicklist['picklistid']])->count(),
        Severity: Critical
        Found in tests/Settings/ModuleManager.php by phan

        Call to undeclared method \Tests\Settings\ModuleManager::assertFileExists
        Open

                    $this->assertFileExists($library['dir'] . 'version.php');
        Severity: Critical
        Found in tests/Settings/ModuleManager.php by phan

        Call to undeclared method \Tests\Settings\ModuleManager::assertNotNull
        Open

                        $this->assertNotNull(
        Severity: Critical
        Found in tests/Settings/ModuleManager.php by phan

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

                        $rowPicklist = (new \App\Db\Query())->from('vtiger_picklist')->where(['name' => $param['fieldName']])->one();
        Severity: Critical
        Found in tests/Settings/ModuleManager.php by phan

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

                            (new \App\Db\Query())->from('vtiger_role')->count() * \count($param['pickListValues']),
        Severity: Critical
        Found in tests/Settings/ModuleManager.php by phan

        Call to undeclared method \Tests\Settings\ModuleManager::assertNull
        Open

                        $this->assertNull($schema->getTableSchema(self::$tablesName[$key]), 'Table "' . self::$tablesName[$key] . '" exist');
        Severity: Critical
        Found in tests/Settings/ModuleManager.php by phan

        Call to undeclared method \Tests\Settings\ModuleManager::assertNull
        Open

                        $this->assertNull($schema->getTableSchema(self::$tablesName[$key]), 'Table "' . self::$tablesName[$key] . '" exist');
        Severity: Critical
        Found in tests/Settings/ModuleManager.php by phan

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

                            (new \App\Db\Query())->from('vtiger_picklist')->where(['name' => $columnName])->exists(),
        Severity: Critical
        Found in tests/Settings/ModuleManager.php by phan

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

                        $this->assertFalse((new \App\Db\Query())->from('s_#__multireference')->where(['source_module' => 'TestModule', 'dest_module' => 'Contacts'])->exists(), 'The record from "s_#__multireference" was not removed.');
        Severity: Critical
        Found in tests/Settings/ModuleManager.php by phan

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

                    (new \App\Db\Query())->from('vtiger_tab')->where(['name' => 'TestModule'])->exists(),
        Severity: Critical
        Found in tests/Settings/ModuleManager.php by phan

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

                $this->assertFalse(
        Severity: Critical
        Found in tests/Settings/ModuleManager.php by phan

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

                        $this->assertNotFalse(
        Severity: Critical
        Found in tests/Settings/ModuleManager.php by phan

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

                        $this->assertSame(
        Severity: Critical
        Found in tests/Settings/ModuleManager.php by phan

        Call to undeclared method \Tests\Settings\ModuleManager::assertTrue
        Open

                        $this->assertTrue((new \App\Db\Query())->from('s_#__multireference')->where(['source_module' => 'TestModule', 'dest_module' => 'Contacts'])->exists(), 'No record in the table "s_yf_multireference" for type ' . $type);
        Severity: Critical
        Found in tests/Settings/ModuleManager.php by phan

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

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

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

                        $this->assertSame(0, (new \App\Db\Query())->from('vtiger_role2picklist')->where(['picklistid' => self::$pickList[$key]])->count(), 'All rows in the table "vtiger_role2picklist" have not been deleted');
        Severity: Critical
        Found in tests/Settings/ModuleManager.php by phan

        Call to undeclared method \Tests\Settings\ModuleManager::assertContains
        Open

                $this->assertContains('manifest.xml', $zipFiles);
        Severity: Critical
        Found in tests/Settings/ModuleManager.php by phan

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

                        $this->assertSame(0, (new \App\Db\Query())->select(['presence'])->from('vtiger_tab')->where(['tabid' => $module->getId()])->scalar());
        Severity: Critical
        Found in tests/Settings/ModuleManager.php by phan

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

                                (new \App\Db\Query())->select($param['fieldName'])->from(self::$tablesName[$key])->column()
        Severity: Critical
        Found in tests/Settings/ModuleManager.php by phan

        Call to undeclared method \Tests\Settings\ModuleManager::assertTrue
        Open

                $this->assertTrue($blockInstance->isCustomized(), 'Block is not customized');
        Severity: Critical
        Found in tests/Settings/ModuleManager.php by phan

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

                $this->assertFalse($moduleModel->isExportable(), 'Module exportable!');
        Severity: Critical
        Found in tests/Settings/ModuleManager.php by phan

        Call to undeclared method \Tests\Settings\ModuleManager::assertTrue
        Open

                $this->assertTrue($moduleModel->isExportable(), 'Module not exportable!');
        Severity: Critical
        Found in tests/Settings/ModuleManager.php by phan

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

                        $this->assertSame(1, (new \App\Db\Query())->select(['presence'])->from('vtiger_tab')->where(['tabid' => $module->getId()])->scalar());
        Severity: Critical
        Found in tests/Settings/ModuleManager.php by phan

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

                        $this->assertSame(0, (new \App\Db\Query())->select(['presence'])->from('vtiger_tab')->where(['tabid' => $module->getId()])->scalar());
        Severity: Critical
        Found in tests/Settings/ModuleManager.php by phan

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

                        $this->assertFalse((new \App\Db\Query())->from('vtiger_field')->where(['fieldid' => self::$fieldsExtraId[$key]])->exists(), 'The record "extra" was not removed from the database ID: ' . self::$fieldsExtraId[$key]);
        Severity: Critical
        Found in tests/Settings/ModuleManager.php by phan

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

                        $this->assertCount(
        Severity: Critical
        Found in tests/Settings/ModuleManager.php by phan

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

                        $this->assertSame((new \App\Db\Query())->from('vtiger_fieldmodulerel')->where(['fieldid' => self::$fieldsId[$key]])->count(), 0, 'Problem with table "vtiger_fieldmodulerel" in database');
        Severity: Critical
        Found in tests/Settings/ModuleManager.php by phan

        Argument 1 (fileName) is string but \App\Zip::openFile() takes bool|false defined at /code/app/Zip.php:51
        Open

                $zip = \App\Zip::openFile(self::$zipFileName, ['checkFiles' => false]);
        Severity: Minor
        Found in tests/Settings/ModuleManager.php by phan

        Call to undeclared method \App\Db::getSchema
        Open

                \App\Db::getInstance()->getSchema()->refresh();
        Severity: Critical
        Found in tests/Settings/ModuleManager.php by phan

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

                $this->assertFalse(
        Severity: Critical
        Found in tests/Settings/ModuleManager.php by phan

        Call to undeclared method \Tests\Settings\ModuleManager::assertTrue
        Open

                    $this->assertTrue(\Settings_ModuleManager_Library_Model::download($key), "The library \"{$key}\" could not be downloaded");
        Severity: Critical
        Found in tests/Settings/ModuleManager.php by phan

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

                        $this->assertSame(1, (new \App\Db\Query())->select(['presence'])->from('vtiger_tab')->where(['tabid' => $module->getId()])->scalar());
        Severity: Critical
        Found in tests/Settings/ModuleManager.php by phan

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            public function testOnAllModule()
            {
                $allModules = \Settings_ModuleManager_Module_Model::getAll();
                $moduleManagerModel = new \Settings_ModuleManager_Module_Model();
                foreach ($allModules as $module) {
        Severity: Major
        Found in tests/Settings/ModuleManager.php and 1 other location - About 1 hr to fix
        tests/Settings/ModuleManager.php on lines 412..423

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 114.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            public function testOffAllModule()
            {
                $allModules = \Settings_ModuleManager_Module_Model::getAll();
                $moduleManagerModel = new \Settings_ModuleManager_Module_Model();
                foreach ($allModules as $module) {
        Severity: Major
        Found in tests/Settings/ModuleManager.php and 1 other location - About 1 hr to fix
        tests/Settings/ModuleManager.php on lines 426..437

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 114.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

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

             */

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

             * Array of fields 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

            /**

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

            private static $treeId;

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

                unlink(ROOT_DIRECTORY . '/PL.zip');

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

            {

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

             * Zip file name.

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

             * Block 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

            {

        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 $blockId;

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

             * @var array()

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

            private static $pickList;

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

                $this->assertTrue(file_exists(ROOT_DIRECTORY . '/PL.zip') && filesize(ROOT_DIRECTORY . '/PL.zip') > 0);

        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

             * Tables name for uitype: 16, 15.

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

                    'entityfieldname' => 'testmodule',

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

            private static $zipFileName;

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

             * @var array()

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

            private static $fieldsExtraId;

        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

             * Testing the module creation.

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

            public function testCreateModule()

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

             * @var string

        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 array()

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

            private static $tablesName;

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

                    'module_name' => 'TestModule',

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

             * Id for picklist.

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

             * Id for field extra.

        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

                $module = \Settings_ModuleManager_Module_Model::createModule([

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

            private static $fieldsId;

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

             */

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

             * Id for tree.

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

             * Testing language exports.

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

                $package->exportLanguage('pl-PL', ROOT_DIRECTORY . '/PL.zip', 'PL.zip');

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

                $package = new \vtlib\LanguageExport();

        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

                $this->assertNotFalse($rowModule);

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

                $this->assertSame(2, $rowModule['premium']);

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

            /**

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

             * @throws Exception

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

                foreach ($allLang as $key => $lang) {

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

                return $langFileToCheck;

        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['MRVField'] = $this->getMRVField();

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

                        $this->assertCount((new \App\Db\Query())->from('vtiger_fieldmodulerel')->where(['fieldid' => self::$fieldsId[$key]])->count(), $param['referenceModule'], 'Problem with table "vtiger_fieldmodulerel" in database');

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

                        $this->assertNotFalse(

        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

             * @var array()

        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 testLanguageExport()

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

                $blockInstance = new \Settings_LayoutEditor_Block_Model();

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

             */

        Line exceeds 120 characters; contains 138 characters
        Open

                $moduleModel = \Settings_LayoutEditor_Module_Model::getInstance('Settings:LayoutEditor')->setSourceModule($param['sourceModule']);

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

                $this->assertCount((new \App\Db\Query())->from('vtiger_profile2field')->where(['fieldid' => self::$fieldsId[$key]])->count(), $profilesId, "The field \"$type\" did not add correctly to the profiles");

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

                        $this->assertNotFalse($rowExtra, 'No "extra" record for uitype: ' . $row['uitype']);

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

                    'entityfieldlabel' => 'TestModule',

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

                $this->assertFileExists(ROOT_DIRECTORY . '/modules/TestModule/TestModule.php');

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

                foreach ($langFileToCheck as $pathToFile) {

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

             */

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

                $moduleModel = \Vtiger_Module_Model::getInstance('TestModule');

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

                $blockInstance->set('label', 'label block');

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

             * @param mixed  $suffix

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

                $key = $type . $suffix;

        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->assertSame($row['typeofdata'], $details['typeofdata']);

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

                                (new \App\Db\Query())->select($param['fieldName'])->from(self::$tablesName[$key])->column()

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

                if ('Tree' === $type || 'CategoryMultipicklist' === $type) {

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

                        );

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

                            (new \App\Db\Query())->from('vtiger_role')->count() * \count($param['pickListValues']),

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

                    case 305: //MultiReferenceValue

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

                    default:

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

                        break;

        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::$blockId = $blockInstance->save($moduleModel);

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

                $param['blockid'] = self::$blockId;

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

                            \App\Db::getInstance()->getTableSchema(self::$tablesName[$key]),

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

                        );

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

                $allLang = \App\Language::getAll();

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

                    $langFileToCheck[] = 'languages' . \DIRECTORY_SEPARATOR . $key . \DIRECTORY_SEPARATOR . $fileName;

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

             * Testing the creation of a new field for the module.

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

            public function testCreateNewField($type, $param, $suffix = '')

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

                $param['sourceModule'] = 'TestModule';

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

                    $param['tree'] = self::$treeId;

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

                } elseif ('MultiReferenceValue' === $type) {

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

                $details = $moduleModel->getTypeDetailsForAddField($type, $param);

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

                $row = (new \App\Db\Query())->from('vtiger_field')->where(['fieldid' => self::$fieldsId[$key], 'tabid' => $moduleModel->getId()])->one();

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

                switch ($row['uitype']) {

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

                        break;

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

                    case 15: //Picklist

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

                            $rowPicklist,

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

                $this->assertIsInt($module->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

            private function getLangPathToFile($fileName)

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

                    'module_label' => 'TestModule',

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

            /**

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

                $rowModule = (new \App\Db\Query())->from('vtiger_tab')->where(['name' => 'TestModule'])->one();

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

             * Testing the creation of a new block for the module.

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

                self::$fieldsId[$key] = $fieldModel->getId();

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

                    //Add a tree if it does not exist

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

                    case 10: //Related1M

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

                                $param['pickListValues'],

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

                        $rowExtra = (new \App\Db\Query())->from('vtiger_field')->where(['fieldname' => $param['fieldName'] . '_extra'])->one();

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

                        $rowPicklist = (new \App\Db\Query())->from('vtiger_picklist')->where(['name' => $param['fieldName']])->one();

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

             *

        Line exceeds 120 characters; contains 230 characters
        Open

                        $this->assertCount(0, array_diff($param['pickListValues'], (new \App\Db\Query())->select($param['fieldName'])->from(self::$tablesName[$key])->column()), 'Bad values in the table "' . self::$tablesName[$key] . '"');

        Line exceeds 120 characters; contains 125 characters
        Open

                        $rowPicklist = (new \App\Db\Query())->from('vtiger_picklist')->where(['name' => $param['fieldName']])->one();

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

            }

        Line exceeds 120 characters; contains 134 characters
        Open

                            (new \App\Db\Query())->from('vtiger_role2picklist')->where(['picklistid' => $rowPicklist['picklistid']])->count(),

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

                $blockInstance->set('iscustom', 1);

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

                        self::$tablesName[$key] = 'vtiger_' . $param['fieldName'];

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

                $row = (new \App\Db\Query())->from('vtiger_blocks')->where(['blockid' => self::$blockId])->one();

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

                        );

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

                            'Table "' . self::$tablesName[$key] . '" does not exist'

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

                $moduleModel = \Settings_LayoutEditor_Module_Model::getInstance('Settings:LayoutEditor')->setSourceModule($param['sourceModule']);

        Line exceeds 120 characters; contains 233 characters
        Open

                        $this->assertTrue((new \App\Db\Query())->from('s_#__multireference')->where(['source_module' => 'TestModule', 'dest_module' => 'Contacts'])->exists(), 'No record in the table "s_yf_multireference" for type ' . $type);

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

                            'Wrong number of rows in the table "vtiger_role2picklist"'

        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

             * @param string $type

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

                $fieldModel = $moduleModel->addField($param['fieldType'], self::$blockId, $param);

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

                        break;

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

             * @dataProvider providerForField

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

                $this->assertSame($row['fieldlabel'], $param['fieldLabel']);

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

             * Get Id of MultiReferenceValue field.

        Line exceeds 120 characters; contains 145 characters
        Open

                $row = (new \App\Db\Query())->from('vtiger_field')->where(['fieldid' => self::$fieldsId[$key], 'tabid' => $moduleModel->getId()])->one();

        Line exceeds 120 characters; contains 135 characters
        Open

                        $rowExtra = (new \App\Db\Query())->from('vtiger_field')->where(['fieldname' => $param['fieldName'] . '_extra'])->one();

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

                    case 33: //MultiSelectCombo

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

                        $this->assertCount(

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

                        self::$tablesName[$key] = 'vtiger_' . $param['fieldName'];

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

                        $this->assertNotNull(\App\Db::getInstance()->getTableSchema(self::$tablesName[$key]), 'Table "' . self::$tablesName[$key] . '" does not exist');

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

                        $this->assertCount(0, array_diff($param['pickListValues'], (new \App\Db\Query())->select($param['fieldName'])->from(self::$tablesName[$key])->column()), 'Bad values in the table "' . self::$tablesName[$key] . '"');

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

                    'premium' => 2,

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

                $langFileToCheck = $this->getLangPathToFile('TestModule.json');

        Line exceeds 120 characters; contains 127 characters
        Open

                        self::$treeId = (new TreesManager())->testAddTree(1, \Vtiger_Module_Model::getInstance('TestModule')->getId());

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

                    case 11: //Phone

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

                        break;

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

                        break;

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

                        $this->assertNotNull(

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

                            0,

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

                        break;

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

                        $this->assertTrue((new \App\Db\Query())->from('s_#__multireference')->where(['source_module' => 'TestModule', 'dest_module' => 'Contacts'])->exists(), 'No record in the table "s_yf_multireference" for type ' . $type);

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

                    'entitytype' => \Vtiger_Module_Model::ADVANCED_TYPE,

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

                $this->assertSame('TestModule', \App\Module::getModuleName($module->getId()), 'The name of the new module is missing: ' . $module->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

             * @param string $fileName

        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->assertNotFalse($row, 'No record id: ' . self::$blockId);

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

                $this->assertSame($row['blocklabel'], 'label block');

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

                $param['fieldName'] = strtolower($type . 'FL' . $suffix);

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

             * @return array

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

            public function testCreateNewBlock()

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

                        self::$treeId = (new TreesManager())->testAddTree(1, \Vtiger_Module_Model::getInstance('TestModule')->getId());

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

                $this->assertNotFalse($row, 'No record id: ' . self::$fieldsId[$key]);

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

                    if (empty(self::$treeId)) {

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

                $this->assertSame($row['fieldname'], $param['fieldName']);

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

                        $this->assertCount((new \App\Db\Query())->from('vtiger_profile2field')->where(['fieldid' => $rowExtra['fieldid']])->count(), $profilesId, "The \"extra\" field \"$type\" did not add correctly to the profiles");

        Line exceeds 120 characters; contains 225 characters
        Open

                        $this->assertCount((new \App\Db\Query())->from('vtiger_profile2field')->where(['fieldid' => $rowExtra['fieldid']])->count(), $profilesId, "The \"extra\" field \"$type\" did not add correctly to the profiles");

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

                        self::$fieldsExtraId[$key] = $rowExtra['fieldid'];

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

                    case 16: //Picklist

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

                            ),

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

                            'The record from "vtiger_picklist" not exists NAME: ' . $param['fieldName']

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

                            (new \App\Db\Query())->from('vtiger_role2picklist')->where(['picklistid' => $rowPicklist['picklistid']])->count(),

        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->assertSame('TestModule', $rowModule['tablabel']);

        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->assertSame($row['iscustom'], 1);

        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->assertSame($row['uitype'], $details['uitype']);

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

                            'Bad values in the table "' . self::$tablesName[$key] . '"'

        Line exceeds 120 characters; contains 148 characters
        Open

                $this->assertSame('TestModule', \App\Module::getModuleName($module->getId()), 'The name of the new module is missing: ' . $module->getId());

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

                $this->assertSame(\Vtiger_Module_Model::ADVANCED_TYPE, $rowModule['type']);

        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

             * @param array  $param

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

                $profilesId = \vtlib\Profile::getAllIds();

        Line exceeds 120 characters; contains 208 characters
        Open

                $this->assertCount((new \App\Db\Query())->from('vtiger_profile2field')->where(['fieldid' => self::$fieldsId[$key]])->count(), $profilesId, "The field \"$type\" did not add correctly to the profiles");

        Line exceeds 120 characters; contains 160 characters
        Open

                        $this->assertNotNull(\App\Db::getInstance()->getTableSchema(self::$tablesName[$key]), 'Table "' . self::$tablesName[$key] . '" does not exist');

        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->assertSame(

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

                    $this->assertFileExists($pathToFile);

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

                $langFileToCheck = [];

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

                $param['fieldType'] = $type;

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

                $param['fieldLabel'] = $type . 'FL' . $suffix;

        Line exceeds 120 characters; contains 228 characters
        Open

                        $this->assertCount((new \App\Db\Query())->from('vtiger_fieldmodulerel')->where(['fieldid' => self::$fieldsId[$key]])->count(), $param['referenceModule'], 'Problem with table "vtiger_fieldmodulerel" in database');

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

                            array_diff(

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

                        self::$pickList[$key] = $param['pickListValues'];

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

                $moduleModel = \Settings_LayoutEditor_Module_Model::getInstance('Settings:LayoutEditor')->setSourceModule('TestModule');

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

             * @return array

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

                    ['Time', ['fieldTypeList' => 0]],

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

             * @dataProvider providerForField

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

                    ['Currency', ['fieldTypeList' => 0, 'fieldLength' => 4, 'decimal' => 3]],

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

                    ['Skype', ['fieldTypeList' => 0]],

        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

                        break;

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

                            "The record from \"vtiger_picklist\" was not removed from the database: {$columnName}"

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

             * Testing the deletion of a new block for the module.

        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

                $zip->close();

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

                foreach ($langFileToCheck as $pathToFile) {

        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 testDownloadLibraryModule()

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

                    $mode = \App\Config::developer('MISSING_LIBRARY_DEV_MODE') ? 'developer' : \App\Version::get($library['name']);

        Line exceeds 120 characters; contains 135 characters
        Open

                    $this->assertTrue(\Settings_ModuleManager_Library_Model::download($key), "The library \"{$key}\" could not be downloaded");

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

                        $moduleManagerModel->enableModule($module->get('name'));

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

                $moduleInstance = \vtlib\Module::getInstance('Contacts');

        Line exceeds 120 characters; contains 122 characters
        Open

                    ['Picklist', ['fieldTypeList' => 0, 'pickListValues' => ['b1', 'b2', 'b3'], 'isRoleBasedPickList' => 1], '2'],

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

                ];

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

             * Testing the deletion of a new field.

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

                        $this->assertFalse((new \App\Db\Query())->from('vtiger_field')->where(['fieldid' => self::$fieldsExtraId[$key]])->exists(), 'The record "extra" was not removed from the database ID: ' . self::$fieldsExtraId[$key]);

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

                        $this->assertSame(0, (new \App\Db\Query())->from('vtiger_role2picklist')->where(['picklistid' => self::$pickList[$key]])->count(), 'All rows in the table "vtiger_role2picklist" have not been deleted');

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

                    default:

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

            /**

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

                    $zipFiles[] = $fileName;

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

                    (new \App\Db\Query())->from('vtiger_tab')->where(['name' => 'TestModule'])->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

                    }

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

             */

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

                $source_Module->setRelatedList($moduleInstance, 'TestRel123', ['ADD', 'SELECT'], 'getRelatedList');

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

                    ['Percent', ['fieldTypeList' => 0]],

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

                    ['Picklist', ['fieldTypeList' => 0, 'pickListValues' => ['b1', 'b2', 'b3'], 'isRoleBasedPickList' => 1], '2'],

        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

                $uitype = $fieldInstance->getUIType();

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

                    case 33: //MultiSelectCombo

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

            {

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

             * Testing module removal.

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

            {

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

                \App\Db::getInstance()->getSchema()->refresh();

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

                $this->assertFileDoesNotExist(ROOT_DIRECTORY . '/modules/TestModule/TestModule.php');

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

                    $this->assertFileDoesNotExist(ROOT_DIRECTORY . \DIRECTORY_SEPARATOR . $pathToFile);

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

                $this->assertFalse(

        Line exceeds 120 characters; contains 157 characters
        Open

                    $this->assertDoesNotMatchRegularExpression('/404/', $header['Status'] ?? '', $library['url'] . "/archive/$mode.zip | " . print_r($header, true));

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

                    $this->assertFileExists($library['dir'] . 'version.php');

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

                $fields = [];

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

             *

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

                    ['Picklist', ['fieldTypeList' => 0, 'pickListValues' => ['a1', 'a2', 'a3']]],

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

                    ['CategoryMultipicklist', ['fieldTypeList' => 0]],

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

                    ['MultiReferenceValue', ['fieldTypeList' => 0, 'MRVModule' => 'Contacts']],

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

             * @see         https://phpunit.de/manual/3.7/en/writing-tests-for-phpunit.html#writing-tests-for-phpunit.data-providers

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

                switch ($uitype) {

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

                    case 11: //Phone

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

                $this->assertFalse($moduleModel->isExportable(), 'Module exportable!');

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

                $this->assertTrue($moduleModel->isExportable(), 'Module not exportable!');

        Line exceeds 120 characters; contains 150 characters
        Open

                        $this->assertSame(1, (new \App\Db\Query())->select(['presence'])->from('vtiger_tab')->where(['tabid' => $module->getId()])->scalar());

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

            public function testOnAllModule()

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

                $moduleManagerModel = new \Settings_ModuleManager_Module_Model();

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

                    //Turn on the module if it is off

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

            public function providerForField()

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

                    ['Text', ['fieldTypeList' => 0, 'fieldLength' => 12]],

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

                    ['Decimal', ['fieldTypeList' => 0, 'fieldLength' => 6, 'decimal' => 2]],

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

                    ['MultiSelectCombo', ['fieldTypeList' => 0, 'pickListValues' => ['c1', 'c2', 'c3']]],

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

                $schema->refresh();

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

                        $this->assertNull($schema->getTableSchema(self::$tablesName[$key]), 'Table "' . self::$tablesName[$key] . '" exist');

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

                        $this->assertFalse(

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

                $this->assertFalse(\Vtiger_Block_Model::checkFieldsExists(self::$blockId), 'Fields exists');

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

                $this->assertFileExists(self::$zipFileName);

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

                }

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

                    $header = get_headers($library['url'] . "/archive/$mode.zip", 1);

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

                $moduleManagerModel = new \Settings_ModuleManager_Module_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

                    }

        Line exceeds 120 characters; contains 128 characters
        Open

                $moduleModel = \Settings_LayoutEditor_Module_Model::getInstance('Settings:LayoutEditor')->setSourceModule('TestModule');

        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

                    ['Editor', ['fieldTypeList' => 0, 'fieldLength' => 100]],

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

                    ['Related1M', ['fieldTypeList' => 0, 'referenceModule' => ['Contacts', 'Accounts', 'Leads']]],

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

                    ['Tree', ['fieldTypeList' => 0]],

        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 testDeleteNewField($type, $param, $suffix = '')

        Line exceeds 120 characters; contains 203 characters
        Open

                        $this->assertSame((new \App\Db\Query())->from('vtiger_fieldmodulerel')->where(['fieldid' => self::$fieldsId[$key]])->count(), 0, 'Problem with table "vtiger_fieldmodulerel" in database');

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

                $this->assertTrue($blockInstance->isCustomized(), 'Block is not customized');

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

            /**

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

                $packageExport = new \vtlib\PackageExport();

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

                $this->assertContains('manifest.xml', $zipFiles);

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

                $moduleInstance = \vtlib\Module::getInstance('TestModule');

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

                    'The test module exists in the database'

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

                    $this->assertDoesNotMatchRegularExpression('/404/', $header['Status'] ?? '', $library['url'] . "/archive/$mode.zip | " . print_r($header, true));

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

                $allModules = \Settings_ModuleManager_Module_Model::getAll();

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

                foreach ($allModules as $module) {

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

                    //Turn off the module if it is on

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

            private function getMRVField()

        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

             * @param mixed $param

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

                $this->assertFalse((new \App\Db\Query())->from('vtiger_field')->where(['fieldid' => self::$fieldsId[$key]])->exists(), 'The record was not removed from the database ID: ' . self::$fieldsId[$key]);

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

                        break;

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

                        $this->assertNull($schema->getTableSchema(self::$tablesName[$key]), 'Table "' . self::$tablesName[$key] . '" exist');

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

                    case 305: //MultiReferenceValue

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

                    (new \App\Db\Query())->from('vtiger_trees_templates')->where(['templateid' => self::$treeId])->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

                }

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

                $source_Module = \vtlib\Module::getInstance('TestModule');

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

                    ['Integer', ['fieldTypeList' => 0, 'fieldLength' => 2]],

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

             *

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

                $columnName = $fieldInstance->getColumnName();

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

                $this->assertTrue($fieldInstance->isCustomField(), 'Field is not customized');

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

                        break;

        Line exceeds 120 characters; contains 217 characters
        Open

                        $this->assertSame(0, (new \App\Db\Query())->from('vtiger_role2picklist')->where(['picklistid' => self::$pickList[$key]])->count(), 'All rows in the table "vtiger_role2picklist" have not been deleted');

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

                        break;

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

                        break;

        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 testDeleteNewBlock()

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

                $blockInstance = \Vtiger_Block_Model::getInstance(self::$blockId);

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

                self::$zipFileName = $packageExport->getZipFileName();

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

                    $fileName = $zip->getNameIndex($i);

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

                    $this->assertContains($pathToFile, $zipFiles);

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

                foreach ($langFileToCheck as $pathToFile) {

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

                    'The tree was not removed'

        Line exceeds 120 characters; contains 150 characters
        Open

                        $this->assertSame(0, (new \App\Db\Query())->select(['presence'])->from('vtiger_tab')->where(['tabid' => $module->getId()])->scalar());

        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

             * Data provider for testCreateNewField and testDeleteNewField.

        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

                    ['Email', ['fieldTypeList' => 0]],

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

                    ['Checkbox', ['fieldTypeList' => 0]],

        Line exceeds 120 characters; contains 230 characters
        Open

                        $this->assertFalse((new \App\Db\Query())->from('vtiger_field')->where(['fieldid' => self::$fieldsExtraId[$key]])->exists(), 'The record "extra" was not removed from the database ID: ' . self::$fieldsExtraId[$key]);

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

                    case 10: //Related1M

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

                        $this->assertSame((new \App\Db\Query())->from('vtiger_fieldmodulerel')->where(['fieldid' => self::$fieldsId[$key]])->count(), 0, 'Problem with table "vtiger_fieldmodulerel" in database');

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

                        break;

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

            }

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

            // Testing download librares.

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

                    $this->assertTrue(\Settings_ModuleManager_Library_Model::download($key), "The library \"{$key}\" could not be downloaded");

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

                        $fields[] = $valF->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

                    ['Phone', ['fieldTypeList' => 0]],

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

                $fieldInstance->delete();

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

                    case 16: //Picklist

        Line exceeds 120 characters; contains 133 characters
        Open

                        $this->assertNull($schema->getTableSchema(self::$tablesName[$key]), 'Table "' . self::$tablesName[$key] . '" exist');

        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

                $blockInstance->delete(false);

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

                $moduleModel = \vtlib\Module::getInstance('TestModule');

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

                $moduleModel->allowExport = true;

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

                $langFileToCheck = $this->getLangPathToFile('TestModule.json');

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

                );

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

                $libraries = \Settings_ModuleManager_Library_Model::getAll();

        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 ($allModules as $module) {

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

                    ['Date', ['fieldTypeList' => 0]],

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

                $fieldInstance = \Settings_LayoutEditor_Field_Model::getInstance(self::$fieldsId[$key]);

        Line exceeds 120 characters; contains 226 characters
        Open

                        $this->assertFalse((new \App\Db\Query())->from('s_#__multireference')->where(['source_module' => 'TestModule', 'dest_module' => 'Contacts'])->exists(), 'The record from "s_#__multireference" was not removed.');

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

                $zipFiles = [];

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

                for ($i = 0; $i < $zip->numFiles; ++$i) {

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

                $langFileToCheck = $this->getLangPathToFile('TestModule.json');

        Line exceeds 120 characters; contains 123 characters
        Open

                    $mode = \App\Config::developer('MISSING_LIBRARY_DEV_MODE') ? 'developer' : \App\Version::get($library['name']);

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

                    if (1 !== (int) $module->get('presence')) {

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

                $allModules = \Settings_ModuleManager_Module_Model::getAll();

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

                foreach ($moduleModel->getRelations() as $value) {

        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 [

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

                    ['URL', ['fieldTypeList' => 0]],

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

                    ['TextArea', ['fieldTypeList' => 0]],

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

             * @param mixed $type

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

             * @param mixed $suffix

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

                            (new \App\Db\Query())->from('vtiger_picklist')->where(['name' => $columnName])->exists(),

        Line exceeds 120 characters; contains 204 characters
        Open

                $this->assertFalse((new \App\Db\Query())->from('vtiger_field')->where(['fieldid' => self::$fieldsId[$key]])->exists(), 'The record was not removed from the database ID: ' . self::$fieldsId[$key]);

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

                    case 15: //Picklist

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

            {

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

             * Testing module export.

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

            public function testExportModule()

        Line exceeds 120 characters; contains 132 characters
        Open

                $this->assertContains('modules' . \DIRECTORY_SEPARATOR . 'TestModule' . \DIRECTORY_SEPARATOR . 'TestModule.php', $zipFiles);

        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->assertSame(0, (new \App\Db\Query())->select(['presence'])->from('vtiger_tab')->where(['tabid' => $module->getId()])->scalar());

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

             */

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

                $moduleInstance->delete();

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

            // Testing module off.

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

                        $this->assertSame(1, (new \App\Db\Query())->select(['presence'])->from('vtiger_tab')->where(['tabid' => $module->getId()])->scalar());

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

            public function testOffAllModule()

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

                return $fields[0];

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

                $schema = \App\Db::getInstance()->getSchema();

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

             */

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

                $packageExport->export($moduleModel, '', '', false);

        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 testDeleteModule()

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

                foreach ($libraries as $key => $library) {

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

                        $moduleManagerModel->disableModule($module->get('name'));

        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 int

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

                    foreach ($value->getFields() as $valF) {

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

                $key = $type . $suffix;

        Line exceeds 120 characters; contains 133 characters
        Open

                        $this->assertNull($schema->getTableSchema(self::$tablesName[$key]), 'Table "' . self::$tablesName[$key] . '" exist');

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

                        $this->assertFalse((new \App\Db\Query())->from('s_#__multireference')->where(['source_module' => 'TestModule', 'dest_module' => 'Contacts'])->exists(), 'The record from "s_#__multireference" was not removed.');

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

                $zip = \App\Zip::openFile(self::$zipFileName, ['checkFiles' => false]);

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

                $this->assertContains('modules' . \DIRECTORY_SEPARATOR . 'TestModule' . \DIRECTORY_SEPARATOR . 'TestModule.php', $zipFiles);

        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->assertFalse(

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

                    //Check if remote file 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

                }

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

            // Testing module on.

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

                    if (0 !== (int) $module->get('presence')) {

        The variable $source_Module is not named in camelCase.
        Open

            private function getMRVField()
            {
                $source_Module = \vtlib\Module::getInstance('TestModule');
                $moduleInstance = \vtlib\Module::getInstance('Contacts');
                $source_Module->setRelatedList($moduleInstance, 'TestRel123', ['ADD', 'SELECT'], 'getRelatedList');
        Severity: Minor
        Found in tests/Settings/ModuleManager.php by phpmd

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $source_Module is not named in camelCase.
        Open

            private function getMRVField()
            {
                $source_Module = \vtlib\Module::getInstance('TestModule');
                $moduleInstance = \vtlib\Module::getInstance('Contacts');
                $source_Module->setRelatedList($moduleInstance, 'TestRel123', ['ADD', 'SELECT'], 'getRelatedList');
        Severity: Minor
        Found in tests/Settings/ModuleManager.php by phpmd

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        There are no issues that match your filters.

        Category
        Status