YetiForceCompany/YetiForceCRM

View on GitHub
tests/App/RecordSearch.php

Summary

Maintainability
A
0 mins
Test Coverage
A
100%

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

        $recordSearch = new \App\RecordSearch('YetiForce', 'Accounts', 10);
Severity: Minor
Found in tests/App/RecordSearch.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 '\Tests\Base\C_RecordActions' in method 'testSearch'.
Open

        $record = \Tests\Base\C_RecordActions::createAccountRecord();
Severity: Minor
Found in tests/App/RecordSearch.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\PrivilegeUpdater' in method 'testSearch'.
Open

        \App\PrivilegeUpdater::update($record->getId(), $record->getModuleName());
Severity: Minor
Found in tests/App/RecordSearch.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

Remove this commented out code.
Open

        // $this->logs = $rows = $recordSearch->search();
Severity: Major
Found in tests/App/RecordSearch.php by sonar-php

Programmers should not comment out code as it bloats programs and reduces readability.

Unused code should be deleted and can be retrieved from source control history if required.

See

  • MISRA C:2004, 2.4 - Sections of code should not be "commented out".
  • MISRA C++:2008, 2-7-2 - Sections of code shall not be "commented out" using C-style comments.
  • MISRA C++:2008, 2-7-3 - Sections of code should not be "commented out" using C++ comments.
  • MISRA C:2012, Dir. 4.4 - Sections of code should not be "commented out"

Remove this commented out code.
Open

        // $recordSearch->operator = 'FulltextWord';
Severity: Major
Found in tests/App/RecordSearch.php by sonar-php

Programmers should not comment out code as it bloats programs and reduces readability.

Unused code should be deleted and can be retrieved from source control history if required.

See

  • MISRA C:2004, 2.4 - Sections of code should not be "commented out".
  • MISRA C++:2008, 2-7-2 - Sections of code shall not be "commented out" using C-style comments.
  • MISRA C++:2008, 2-7-3 - Sections of code should not be "commented out" using C++ comments.
  • MISRA C:2012, Dir. 4.4 - Sections of code should not be "commented out"

Call to undeclared method \Tests\App\RecordSearch::assertNotEmpty
Open

        $this->assertNotEmpty($rows);
Severity: Critical
Found in tests/App/RecordSearch.php by phan

Call to undeclared method \Tests\App\RecordSearch::assertNotFalse
Open

        $this->assertNotFalse($key);
Severity: Critical
Found in tests/App/RecordSearch.php by phan

Call to undeclared method \Tests\App\RecordSearch::assertEquals
Open

        $this->assertEquals('YetiForce S.A.', $rows[$key]['label'], "Not found '$key' ({$record->getId()}) in" . print_r($rows, true));
Severity: Critical
Found in tests/App/RecordSearch.php by phan

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

        // $this->assertArrayHasKey($record->getId(), $rows, 'Record id not found');
Severity: Minor
Found in tests/App/RecordSearch.php by phpcodesniffer

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

        // $this->logs = $row;
Severity: Minor
Found in tests/App/RecordSearch.php by phpcodesniffer

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

        // $recordSearch->operator = 'FulltextWord';
Severity: Minor
Found in tests/App/RecordSearch.php by phpcodesniffer

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

        $this->assertNotEmpty($rows);
Severity: Minor
Found in tests/App/RecordSearch.php by phpcodesniffer

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

        // $row = reset($rows);
Severity: Minor
Found in tests/App/RecordSearch.php by phpcodesniffer

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

        // $this->assertArrayHasKey($record->getId(), $rows, 'Record id not found');
Severity: Minor
Found in tests/App/RecordSearch.php by phpcodesniffer

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

        $recordSearch->operator = 'FulltextBegin';
Severity: Minor
Found in tests/App/RecordSearch.php by phpcodesniffer

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

        $key = array_search($record->getId(), array_column($rows, 'crmid'));
Severity: Minor
Found in tests/App/RecordSearch.php by phpcodesniffer

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

        // $this->assertNotEmpty($rows);
Severity: Minor
Found in tests/App/RecordSearch.php by phpcodesniffer

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

        $recordSearch = new \App\RecordSearch('YetiForce', 'Accounts', 10);
Severity: Minor
Found in tests/App/RecordSearch.php by phpcodesniffer

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

        // $this->assertEquals('YetiForce S.A.', $row['searchlabel']);
Severity: Minor
Found in tests/App/RecordSearch.php by phpcodesniffer

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

        $record = \Tests\Base\C_RecordActions::createAccountRecord();
Severity: Minor
Found in tests/App/RecordSearch.php by phpcodesniffer

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

        // $this->assertNotEmpty($rows);
Severity: Minor
Found in tests/App/RecordSearch.php by phpcodesniffer

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

        $this->logs = $rows = $recordSearch->search();
Severity: Minor
Found in tests/App/RecordSearch.php by phpcodesniffer

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

    /**
Severity: Minor
Found in tests/App/RecordSearch.php by phpcodesniffer

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

        // $this->assertArrayHasKey('matcher', $row);
Severity: Minor
Found in tests/App/RecordSearch.php by phpcodesniffer

Line exceeds 120 characters; contains 135 characters
Open

        $this->assertEquals('YetiForce S.A.', $rows[$key]['label'], "Not found '$key' ({$record->getId()}) in" . print_r($rows, true));
Severity: Minor
Found in tests/App/RecordSearch.php by phpcodesniffer

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

        // $this->logs = $rows = $recordSearch->search();
Severity: Minor
Found in tests/App/RecordSearch.php by phpcodesniffer

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

    }
Severity: Minor
Found in tests/App/RecordSearch.php by phpcodesniffer

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

        // $this->logs = $row;
Severity: Minor
Found in tests/App/RecordSearch.php by phpcodesniffer

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

        $this->assertEquals('YetiForce S.A.', $rows[$key]['label'], "Not found '$key' ({$record->getId()}) in" . print_r($rows, true));
Severity: Minor
Found in tests/App/RecordSearch.php by phpcodesniffer

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

     * Record search test.
Severity: Minor
Found in tests/App/RecordSearch.php by phpcodesniffer

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

        // $this->logs = $rows = $recordSearch->search();
Severity: Minor
Found in tests/App/RecordSearch.php by phpcodesniffer

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

        // $this->assertEquals('YetiForce S.A.', $row['searchlabel']);
Severity: Minor
Found in tests/App/RecordSearch.php by phpcodesniffer

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

        \App\PrivilegeUpdater::update($record->getId(), $record->getModuleName());
Severity: Minor
Found in tests/App/RecordSearch.php by phpcodesniffer

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

        $recordSearch->setMode(\App\RecordSearch::LABEL_MODE);
Severity: Minor
Found in tests/App/RecordSearch.php by phpcodesniffer

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

        $this->assertNotFalse($key);
Severity: Minor
Found in tests/App/RecordSearch.php by phpcodesniffer

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

    {
Severity: Minor
Found in tests/App/RecordSearch.php by phpcodesniffer

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

     */
Severity: Minor
Found in tests/App/RecordSearch.php by phpcodesniffer

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

    public function testSearch()
Severity: Minor
Found in tests/App/RecordSearch.php by phpcodesniffer

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

        // $row = reset($rows);
Severity: Minor
Found in tests/App/RecordSearch.php by phpcodesniffer

There are no issues that match your filters.

Category
Status