midasplatform/Midas

View on GitHub
modules/visualize/tests/controllers/IndexControllerTest.php

Summary

Maintainability
A
1 hr
Test Coverage

Method testIndexAction has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function testIndexAction()
    {
        /** @var GroupModel $groupModel */
        $groupModel = MidasLoader::loadModel('Group');

Severity: Minor
Found in modules/visualize/tests/controllers/IndexControllerTest.php - About 1 hr to fix

Missing class import via use statement (line '53', column '44').
Open

        Zend_Registry::set('notifier', new MIDAS_Notifier(false, null));

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 'MidasLoader' in method 'testIndexAction'.
Open

        $folderModel = MidasLoader::loadModel('Folder');

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 'MidasLoader' in method 'testIndexAction'.
Open

        $itempolicygroupModel = MidasLoader::loadModel('Itempolicygroup');

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 'MidasLoader' in method 'testIndexAction'.
Open

        $userModel = MidasLoader::loadModel('User');

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 'Zend_Registry' in method 'testIndexAction'.
Open

        Zend_Registry::set('notifier', new MIDAS_Notifier(false, null));

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 'MidasLoader' in method 'testIndexAction'.
Open

        $uploadComponent = MidasLoader::loadComponent('Upload');

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 'MidasLoader' in method 'testIndexAction'.
Open

        $groupModel = MidasLoader::loadModel('Group');

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

Each class must be in a namespace of at least one level (a top-level vendor name)
Open

class Visualize_IndexControllerTest extends ControllerTestCase

The class Visualize_IndexControllerTest is not named in CamelCase.
Open

class Visualize_IndexControllerTest extends ControllerTestCase
{
    /** set up tests */
    public function setUp()
    {

CamelCaseClassName

Since: 0.2

It is considered best practice to use the CamelCase notation to name classes.

Example

class class_name {
}

Source

Class name "Visualize_IndexControllerTest" is not in camel caps format
Open

class Visualize_IndexControllerTest extends ControllerTestCase

There are no issues that match your filters.

Category
Status