YetiForceCompany/YetiForceCRM

View on GitHub
tests/Settings/OSSMail.php

Summary

Maintainability
A
0 mins
Test Coverage
A
100%

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

        $configurator = new \App\ConfigFile('module', 'OSSMail');
Severity: Minor
Found in tests/Settings/OSSMail.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 '\App\Config' in method 'testChangeConfig'.
Open

        $this->assertSame('YetiForce_Test', \App\Config::module('OSSMail', 'des_key'));
Severity: Minor
Found in tests/Settings/OSSMail.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 'testChangeConfig'.
Open

        $this->assertCount(0, array_diff(\App\Config::module('OSSMail', 'imap_host'), ['ssl://imap.mail.yahoo.com:993' => 'ssl://imap.mail.yahoo.com', 'ssl://imap.YT_Test.com:993' => 'ssl://imap.YT_Test.com']));
Severity: Minor
Found in tests/Settings/OSSMail.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 "OSSMail" 3 times.
Open

        $configurator = new \App\ConfigFile('module', 'OSSMail');
Severity: Critical
Found in tests/Settings/OSSMail.php by sonar-php

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

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

Noncompliant Code Example

With the default threshold of 3:

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

Compliant Solution

ACTION_1 = 'action1';

function run() {
  prepare(ACTION_1);
  execute(ACTION_1);
  release(ACTION_1);
}

Exceptions

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

Call to undeclared method \tests\Settings\OSSMail::assertCount
Open

        $this->assertCount(0, array_diff(\App\Config::module('OSSMail', 'imap_host'), ['ssl://imap.mail.yahoo.com:993' => 'ssl://imap.mail.yahoo.com', 'ssl://imap.YT_Test.com:993' => 'ssl://imap.YT_Test.com']));
Severity: Critical
Found in tests/Settings/OSSMail.php by phan

Call to undeclared method \tests\Settings\OSSMail::assertSame
Open

        $this->assertSame('YetiForce_Test', \App\Config::module('OSSMail', 'des_key'));
Severity: Critical
Found in tests/Settings/OSSMail.php by phan

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

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

Line exceeds 120 characters; contains 164 characters
Open

        $configurator->set('imap_host', ['ssl://imap.mail.yahoo.com:993' => 'ssl://imap.mail.yahoo.com', 'ssl://imap.YT_Test.com:993' => 'ssl://imap.YT_Test.com']);
Severity: Minor
Found in tests/Settings/OSSMail.php by phpcodesniffer

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

        $this->assertSame('YetiForce_Test', \App\Config::module('OSSMail', 'des_key'));
Severity: Minor
Found in tests/Settings/OSSMail.php by phpcodesniffer

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

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

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

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

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

     * Testing change configuration for Roundcube.
Severity: Minor
Found in tests/Settings/OSSMail.php by phpcodesniffer

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

        $configurator = new \App\ConfigFile('module', 'OSSMail');
Severity: Minor
Found in tests/Settings/OSSMail.php by phpcodesniffer

Line exceeds 120 characters; contains 211 characters
Open

        $this->assertCount(0, array_diff(\App\Config::module('OSSMail', 'imap_host'), ['ssl://imap.mail.yahoo.com:993' => 'ssl://imap.mail.yahoo.com', 'ssl://imap.YT_Test.com:993' => 'ssl://imap.YT_Test.com']));
Severity: Minor
Found in tests/Settings/OSSMail.php by phpcodesniffer

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

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

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

        $this->assertCount(0, array_diff(\App\Config::module('OSSMail', 'imap_host'), ['ssl://imap.mail.yahoo.com:993' => 'ssl://imap.mail.yahoo.com', 'ssl://imap.YT_Test.com:993' => 'ssl://imap.YT_Test.com']));
Severity: Minor
Found in tests/Settings/OSSMail.php by phpcodesniffer

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

        $configurator->set('des_key', 'YetiForce_Test');
Severity: Minor
Found in tests/Settings/OSSMail.php by phpcodesniffer

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

        $configurator->create();
Severity: Minor
Found in tests/Settings/OSSMail.php by phpcodesniffer

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

        $configurator->set('imap_host', ['ssl://imap.mail.yahoo.com:993' => 'ssl://imap.mail.yahoo.com', 'ssl://imap.YT_Test.com:993' => 'ssl://imap.YT_Test.com']);
Severity: Minor
Found in tests/Settings/OSSMail.php by phpcodesniffer

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

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

There are no issues that match your filters.

Category
Status