YetiForceCompany/YetiForceCRM

View on GitHub
tests/Settings/Inventory.php

Summary

Maintainability
A
3 hrs
Test Coverage
A
100%

Method save has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    private function save($id, $type, $name, $value, $status, $default = false)
Severity: Minor
Found in tests/Settings/Inventory.php - About 45 mins to fix

    Missing class import via use statement (line '57', column '23').
    Open

                $recordModel = new \Settings_Inventory_Record_Model();
    Severity: Minor
    Found in tests/Settings/Inventory.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 '160', column '27').
    Open

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

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

            $row = (new \App\Db\Query())->from($tableName)->where(['id' => self::$id])->one();
    Severity: Minor
    Found in tests/Settings/Inventory.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

    The method save has a boolean flag argument $default, which is a certain sign of a Single Responsibility Principle violation.
    Open

        private function save($id, $type, $name, $value, $status, $default = false)
    Severity: Minor
    Found in tests/Settings/Inventory.php by phpmd

    BooleanArgumentFlag

    Since: 1.4.0

    A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

    Example

    class Foo {
        public function bar($flag = true) {
        }
    }

    Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

    Missing class import via use statement (line '143', column '15').
    Open

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

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

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

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

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

    Source http://phpmd.org/rules/cleancode.html#MissingImport

    Missing class import via use statement (line '176', column '15').
    Open

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

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

            $recordModel = \Settings_Inventory_Record_Model::getInstanceById(self::$id, $type);
    Severity: Minor
    Found in tests/Settings/Inventory.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_Inventory_Record_Model' in method 'testDeleteCreditLimits'.
    Open

            $tableName = \Settings_Inventory_Record_Model::getTableNameFromType($type);
    Severity: Minor
    Found in tests/Settings/Inventory.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_Inventory_Record_Model' in method 'testAddDiscount'.
    Open

            $tableName = \Settings_Inventory_Record_Model::getTableNameFromType($type);
    Severity: Minor
    Found in tests/Settings/Inventory.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_Inventory_Record_Model' in method 'testEditDiscount'.
    Open

            $tableName = \Settings_Inventory_Record_Model::getTableNameFromType($type);
    Severity: Minor
    Found in tests/Settings/Inventory.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_Inventory_Record_Model' in method 'testEditCreditLimits'.
    Open

            $tableName = \Settings_Inventory_Record_Model::getTableNameFromType($type);
    Severity: Minor
    Found in tests/Settings/Inventory.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_Inventory_Record_Model' in method 'testDeleteTaxes'.
    Open

            $recordModel = \Settings_Inventory_Record_Model::getInstanceById(self::$id, $type);
    Severity: Minor
    Found in tests/Settings/Inventory.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_Inventory_Record_Model' in method 'testDeleteDiscount'.
    Open

            $tableName = \Settings_Inventory_Record_Model::getTableNameFromType($type);
    Severity: Minor
    Found in tests/Settings/Inventory.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

    The method save uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
    Open

            } else {
                $recordModel = \Settings_Inventory_Record_Model::getInstanceById($id, $type);
            }
    Severity: Minor
    Found in tests/Settings/Inventory.php by phpmd

    ElseExpression

    Since: 1.4.0

    An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

    Example

    class Foo
    {
        public function bar($flag)
        {
            if ($flag) {
                // one branch
            } else {
                // another branch
            }
        }
    }

    Source https://phpmd.org/rules/cleancode.html#elseexpression

    Avoid using static access to class '\Settings_Inventory_Record_Model' in method 'save'.
    Open

                $recordModel = \Settings_Inventory_Record_Model::getInstanceById($id, $type);
    Severity: Minor
    Found in tests/Settings/Inventory.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 '\CurrencyField' in method 'save'.
    Open

                $recordModel->set('value', \CurrencyField::convertToDBFormat($recordModel->get('value')));
    Severity: Minor
    Found in tests/Settings/Inventory.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_Inventory_Record_Model' in method 'testDeleteTaxes'.
    Open

            $tableName = \Settings_Inventory_Record_Model::getTableNameFromType($type);
    Severity: Minor
    Found in tests/Settings/Inventory.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_Inventory_Record_Model' in method 'testEditTaxes'.
    Open

            $tableName = \Settings_Inventory_Record_Model::getTableNameFromType($type);
    Severity: Minor
    Found in tests/Settings/Inventory.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_Inventory_Record_Model' in method 'testDeleteDiscount'.
    Open

            $recordModel = \Settings_Inventory_Record_Model::getInstanceById(self::$id, $type);
    Severity: Minor
    Found in tests/Settings/Inventory.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_Inventory_Record_Model' in method 'testAddCreditLimits'.
    Open

            $tableName = \Settings_Inventory_Record_Model::getTableNameFromType($type);
    Severity: Minor
    Found in tests/Settings/Inventory.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_Inventory_Record_Model' in method 'testAddTaxes'.
    Open

            $tableName = \Settings_Inventory_Record_Model::getTableNameFromType($type);
    Severity: Minor
    Found in tests/Settings/Inventory.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 "No record id: " 6 times.
    Open

            $this->assertNotFalse($row, 'No record id: ' . self::$id);
    Severity: Critical
    Found in tests/Settings/Inventory.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 "The record was not removed from the database ID: " 3 times.
    Open

            $this->assertFalse((new \App\Db\Query())->from($tableName)->where(['id' => self::$id])->exists(), 'The record was not removed from the database ID: ' . self::$id);
    Severity: Critical
    Found in tests/Settings/Inventory.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 "CreditLimits" 3 times.
    Open

            $type = 'CreditLimits';
    Severity: Critical
    Found in tests/Settings/Inventory.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 "value" 9 times.
    Open

            $this->assertSame((float) $row['value'], $value);
    Severity: Critical
    Found in tests/Settings/Inventory.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 "Id is null" 3 times.
    Open

            $this->assertNotNull(self::$id, 'Id is null');
    Severity: Critical
    Found in tests/Settings/Inventory.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 "Taxes" 4 times.
    Open

            $type = 'Taxes';
    Severity: Critical
    Found in tests/Settings/Inventory.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 "test edit" 3 times.
    Open

            $name = 'test edit';
    Severity: Critical
    Found in tests/Settings/Inventory.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 "Discounts" 4 times.
    Open

            if ('Discounts' === $type) {
    Severity: Critical
    Found in tests/Settings/Inventory.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 "status" 7 times.
    Open

            $this->assertSame((int) $row['status'], $status);
    Severity: Critical
    Found in tests/Settings/Inventory.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 "default" 3 times.
    Open

            $this->assertSame((int) $row['default'], $default);
    Severity: Critical
    Found in tests/Settings/Inventory.php by sonar-php

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

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

    Noncompliant Code Example

    With the default threshold of 3:

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

    Compliant Solution

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

    Exceptions

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            $this->assertNotNull(self::$id, 'Id is null');
    Severity: Critical
    Found in tests/Settings/Inventory.php by phan

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Argument 1 (id) is '' but \Tests\Settings\Inventory::save() takes int defined at /code/tests/Settings/Inventory.php:54
    Open

            self::$id = $this->save('', $type, $name, $value, $status);
    Severity: Minor
    Found in tests/Settings/Inventory.php by phan

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

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

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

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

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

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

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

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

    Argument 1 (id) is '' but \Tests\Settings\Inventory::save() takes int defined at /code/tests/Settings/Inventory.php:54
    Open

            self::$id = $this->save('', $type, $name, $value, $status);
    Severity: Minor
    Found in tests/Settings/Inventory.php by phan

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            $this->assertNotNull(self::$id, 'Id is null');
    Severity: Critical
    Found in tests/Settings/Inventory.php by phan

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

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

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

            $this->assertNotNull(self::$id, 'Id is null');
    Severity: Critical
    Found in tests/Settings/Inventory.php by phan

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

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

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

        public function testDeleteCreditLimits()
        {
            $type = 'CreditLimits';
            $recordModel = \Settings_Inventory_Record_Model::getInstanceById(self::$id, $type);
            $recordModel->delete();
    Severity: Major
    Found in tests/Settings/Inventory.php and 2 other locations - About 55 mins to fix
    tests/Settings/Inventory.php on lines 101..109
    tests/Settings/Inventory.php on lines 153..161

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

    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 3 locations. Consider refactoring.
    Open

        public function testDeleteTaxes()
        {
            $type = 'Taxes';
            $recordModel = \Settings_Inventory_Record_Model::getInstanceById(self::$id, $type);
            $recordModel->delete();
    Severity: Major
    Found in tests/Settings/Inventory.php and 2 other locations - About 55 mins to fix
    tests/Settings/Inventory.php on lines 153..161
    tests/Settings/Inventory.php on lines 205..213

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

    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 3 locations. Consider refactoring.
    Open

        public function testDeleteDiscount()
        {
            $type = 'Discounts';
            $recordModel = \Settings_Inventory_Record_Model::getInstanceById(self::$id, $type);
            $recordModel->delete();
    Severity: Major
    Found in tests/Settings/Inventory.php and 2 other locations - About 55 mins to fix
    tests/Settings/Inventory.php on lines 101..109
    tests/Settings/Inventory.php on lines 205..213

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

    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

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

        private function save($id, $type, $name, $value, $status, $default = false)
    Severity: Minor
    Found in tests/Settings/Inventory.php by phpmd

    ShortVariable

    Since: 0.2

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

    Example

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

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

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

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

    ShortVariable

    Since: 0.2

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

    Example

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

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

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

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

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

         * @param int       $status
    Severity: Minor
    Found in tests/Settings/Inventory.php by phpcodesniffer

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

            if (false !== $default && 'Taxes' === $type) {
    Severity: Minor
    Found in tests/Settings/Inventory.php by phpcodesniffer

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

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

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

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

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

         * @param mixed     $default
    Severity: Minor
    Found in tests/Settings/Inventory.php by phpcodesniffer

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

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

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

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

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

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

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

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

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

                $recordModel = new \Settings_Inventory_Record_Model();
    Severity: Minor
    Found in tests/Settings/Inventory.php by phpcodesniffer

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

            } else {
    Severity: Minor
    Found in tests/Settings/Inventory.php by phpcodesniffer

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

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

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

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

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

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

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

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

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

            $status = $default = 1;
    Severity: Minor
    Found in tests/Settings/Inventory.php by phpcodesniffer

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

            $type = 'Taxes';
    Severity: Minor
    Found in tests/Settings/Inventory.php by phpcodesniffer

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

            $recordModel = \Settings_Inventory_Record_Model::getInstanceById(self::$id, $type);
    Severity: Minor
    Found in tests/Settings/Inventory.php by phpcodesniffer

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

            $tableName = \Settings_Inventory_Record_Model::getTableNameFromType($type);
    Severity: Minor
    Found in tests/Settings/Inventory.php by phpcodesniffer

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

         * Testing discount creation.
    Severity: Minor
    Found in tests/Settings/Inventory.php by phpcodesniffer

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

            $name = 'test';
    Severity: Minor
    Found in tests/Settings/Inventory.php by phpcodesniffer

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

                $recordModel = \Settings_Inventory_Record_Model::getInstanceById($id, $type);
    Severity: Minor
    Found in tests/Settings/Inventory.php by phpcodesniffer

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

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

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

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

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

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

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

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

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

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

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

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

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

         * @param float|int $value
    Severity: Minor
    Found in tests/Settings/Inventory.php by phpcodesniffer

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

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

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

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

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

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

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

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

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

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

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

         * @param string    $type
    Severity: Minor
    Found in tests/Settings/Inventory.php by phpcodesniffer

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

         * @param string    $name
    Severity: Minor
    Found in tests/Settings/Inventory.php by phpcodesniffer

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

         * Testing taxes edition.
    Severity: Minor
    Found in tests/Settings/Inventory.php by phpcodesniffer

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

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

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

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

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

            $type = 'Taxes';
    Severity: Minor
    Found in tests/Settings/Inventory.php by phpcodesniffer

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

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

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

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

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

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

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

            self::$id = $this->save(0, $type, $name, $value, $status, $default);
    Severity: Minor
    Found in tests/Settings/Inventory.php by phpcodesniffer

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

            $this->assertNotNull(self::$id, 'Id is null');
    Severity: Minor
    Found in tests/Settings/Inventory.php by phpcodesniffer

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

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

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

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

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

         * @param int       $id
    Severity: Minor
    Found in tests/Settings/Inventory.php by phpcodesniffer

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

                $recordModel->set('value', \CurrencyField::convertToDBFormat($recordModel->get('value')));
    Severity: Minor
    Found in tests/Settings/Inventory.php by phpcodesniffer

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

            $name = 'test edit';
    Severity: Minor
    Found in tests/Settings/Inventory.php by phpcodesniffer

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

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

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

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

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

            $tableName = \Settings_Inventory_Record_Model::getTableNameFromType($type);
    Severity: Minor
    Found in tests/Settings/Inventory.php by phpcodesniffer

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

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

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

            $recordModel->setType($type);
    Severity: Minor
    Found in tests/Settings/Inventory.php by phpcodesniffer

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

            $this->save(self::$id, $type, $name, $value, $status, $default);
    Severity: Minor
    Found in tests/Settings/Inventory.php by phpcodesniffer

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

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

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

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

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

         * Testing taxes creation.
    Severity: Minor
    Found in tests/Settings/Inventory.php by phpcodesniffer

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

            $value = 3.14;
    Severity: Minor
    Found in tests/Settings/Inventory.php by phpcodesniffer

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

            if (empty($id)) {
    Severity: Minor
    Found in tests/Settings/Inventory.php by phpcodesniffer

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

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

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

            $value = 1.16;
    Severity: Minor
    Found in tests/Settings/Inventory.php by phpcodesniffer

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

         * Testing taxes deletion.
    Severity: Minor
    Found in tests/Settings/Inventory.php by phpcodesniffer

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

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

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

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

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

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

    Line exceeds 120 characters; contains 171 characters
    Open

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

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

            $type = 'Taxes';
    Severity: Minor
    Found in tests/Settings/Inventory.php by phpcodesniffer

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

            $status = $default = 0;
    Severity: Minor
    Found in tests/Settings/Inventory.php by phpcodesniffer

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

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

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

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

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

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

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

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

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

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

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

         * @return int
    Severity: Minor
    Found in tests/Settings/Inventory.php by phpcodesniffer

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

            if ('Discounts' === $type) {
    Severity: Minor
    Found in tests/Settings/Inventory.php by phpcodesniffer

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

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

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

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

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

            $tableName = \Settings_Inventory_Record_Model::getTableNameFromType($type);
    Severity: Minor
    Found in tests/Settings/Inventory.php by phpcodesniffer

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

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

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

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

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

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

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

         * Save to database.
    Severity: Minor
    Found in tests/Settings/Inventory.php by phpcodesniffer

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

        private function save($id, $type, $name, $value, $status, $default = false)
    Severity: Minor
    Found in tests/Settings/Inventory.php by phpcodesniffer

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

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

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

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

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

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

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

            $type = 'Discounts';
    Severity: Minor
    Found in tests/Settings/Inventory.php by phpcodesniffer

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

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

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

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

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

            $name = 'test';
    Severity: Minor
    Found in tests/Settings/Inventory.php by phpcodesniffer

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

            $value = 500;
    Severity: Minor
    Found in tests/Settings/Inventory.php by phpcodesniffer

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

            $tableName = \Settings_Inventory_Record_Model::getTableNameFromType($type);
    Severity: Minor
    Found in tests/Settings/Inventory.php by phpcodesniffer

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

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

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

         * Testing credit limits edition.
    Severity: Minor
    Found in tests/Settings/Inventory.php by phpcodesniffer

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

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

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

            $name = 'test edit';
    Severity: Minor
    Found in tests/Settings/Inventory.php by phpcodesniffer

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

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

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

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

    Line exceeds 120 characters; contains 171 characters
    Open

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

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

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

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

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

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

            $tableName = \Settings_Inventory_Record_Model::getTableNameFromType($type);
    Severity: Minor
    Found in tests/Settings/Inventory.php by phpcodesniffer

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

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

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

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

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

            $type = 'CreditLimits';
    Severity: Minor
    Found in tests/Settings/Inventory.php by phpcodesniffer

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

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

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

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

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

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

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

            $value = 2.62;
    Severity: Minor
    Found in tests/Settings/Inventory.php by phpcodesniffer

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

            $recordModel = \Settings_Inventory_Record_Model::getInstanceById(self::$id, $type);
    Severity: Minor
    Found in tests/Settings/Inventory.php by phpcodesniffer

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

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

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

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

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

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

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

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

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

            $this->save(self::$id, $type, $name, $value, $status);
    Severity: Minor
    Found in tests/Settings/Inventory.php by phpcodesniffer

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

            $tableName = \Settings_Inventory_Record_Model::getTableNameFromType($type);
    Severity: Minor
    Found in tests/Settings/Inventory.php by phpcodesniffer

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

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

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

            $tableName = \Settings_Inventory_Record_Model::getTableNameFromType($type);
    Severity: Minor
    Found in tests/Settings/Inventory.php by phpcodesniffer

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            $status = 0;
    Severity: Minor
    Found in tests/Settings/Inventory.php by phpcodesniffer

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

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

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

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

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

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

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

            $type = 'Discounts';
    Severity: Minor
    Found in tests/Settings/Inventory.php by phpcodesniffer

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

            $name = 'test edit';
    Severity: Minor
    Found in tests/Settings/Inventory.php by phpcodesniffer

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

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

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

            $type = 'Discounts';
    Severity: Minor
    Found in tests/Settings/Inventory.php by phpcodesniffer

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

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

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

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

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

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

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

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

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

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

    Line exceeds 120 characters; contains 171 characters
    Open

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

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

            self::$id = $this->save('', $type, $name, $value, $status);
    Severity: Minor
    Found in tests/Settings/Inventory.php by phpcodesniffer

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

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

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

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

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

         * Testing credit limits deletion.
    Severity: Minor
    Found in tests/Settings/Inventory.php by phpcodesniffer

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

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

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

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

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

         * Testing discount edition.
    Severity: Minor
    Found in tests/Settings/Inventory.php by phpcodesniffer

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

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

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

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

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

         * Testing credit limits creation.
    Severity: Minor
    Found in tests/Settings/Inventory.php by phpcodesniffer

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

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

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

            $this->assertNotNull(self::$id, 'Id is null');
    Severity: Minor
    Found in tests/Settings/Inventory.php by phpcodesniffer

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

            $this->save(self::$id, $type, $name, $value, $status);
    Severity: Minor
    Found in tests/Settings/Inventory.php by phpcodesniffer

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

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

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

            $type = 'CreditLimits';
    Severity: Minor
    Found in tests/Settings/Inventory.php by phpcodesniffer

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

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

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

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

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

            $recordModel = \Settings_Inventory_Record_Model::getInstanceById(self::$id, $type);
    Severity: Minor
    Found in tests/Settings/Inventory.php by phpcodesniffer

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

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

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

            self::$id = $this->save('', $type, $name, $value, $status);
    Severity: Minor
    Found in tests/Settings/Inventory.php by phpcodesniffer

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

            $this->assertNotNull(self::$id, 'Id is null');
    Severity: Minor
    Found in tests/Settings/Inventory.php by phpcodesniffer

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

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

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

         * Testing discount deletion.
    Severity: Minor
    Found in tests/Settings/Inventory.php by phpcodesniffer

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

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

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

            $value = 1410;
    Severity: Minor
    Found in tests/Settings/Inventory.php by phpcodesniffer

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

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

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

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

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

            $name = 'test name';
    Severity: Minor
    Found in tests/Settings/Inventory.php by phpcodesniffer

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

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

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

            $type = 'CreditLimits';
    Severity: Minor
    Found in tests/Settings/Inventory.php by phpcodesniffer

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

            $tableName = \Settings_Inventory_Record_Model::getTableNameFromType($type);
    Severity: Minor
    Found in tests/Settings/Inventory.php by phpcodesniffer

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

            $value = 3.14;
    Severity: Minor
    Found in tests/Settings/Inventory.php by phpcodesniffer

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

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

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

            $tableName = \Settings_Inventory_Record_Model::getTableNameFromType($type);
    Severity: Minor
    Found in tests/Settings/Inventory.php by phpcodesniffer

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

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

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

            $status = 0;
    Severity: Minor
    Found in tests/Settings/Inventory.php by phpcodesniffer

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

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

    There are no issues that match your filters.

    Category
    Status