open-orchestra/open-orchestra-cms-bundle

View on GitHub
Backoffice/Tests/Form/Type/Component/NodeChoiceTypeTest.php

Summary

Maintainability
A
0 mins
Test Coverage

Avoid using static access to class '\Phake' in method 'testConfigureOptions'.
Open

        $resolver = Phake::mock('Symfony\Component\OptionsResolver\OptionsResolver');

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 '\Phake' in method 'setUp'.
Open

        $currentSiteManager = Phake::mock('OpenOrchestra\Backoffice\Context\ContextBackOfficeInterface');

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 '\Phake' in method 'testConfigureOptions'.
Open

        Phake::when($this->nodeRepository)->findTreeNode(Phake::anyParameters())->thenReturn(

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 '\Phake' in method 'setUp'.
Open

        $this->node1 = Phake::mock('OpenOrchestra\ModelInterface\Model\NodeInterface');

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 '\Phake' in method 'setUp'.
Open

        $this->node2 = Phake::mock('OpenOrchestra\ModelInterface\Model\NodeInterface');

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 '\Phake' in method 'setUp'.
Open

        $this->nodeRepository = Phake::mock('OpenOrchestra\ModelInterface\Repository\NodeRepositoryInterface');

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

Call to method verify from undeclared class \Phake
Open

        Phake::verify($resolver)->setDefaults(

Call to method mock from undeclared class \Phake
Open

        $this->node2 = Phake::mock('OpenOrchestra\ModelInterface\Model\NodeInterface');

Call to undeclared method \OpenOrchestra\Backoffice\Tests\Form\Type\Component\NodeChoiceTypeTest::assertInstanceOf
Open

        $this->assertInstanceOf('Symfony\Component\Form\AbstractType', $this->orchestraNodeChoiceType);

Call to undeclared method \OpenOrchestra\Backoffice\Tests\Form\Type\Component\NodeChoiceTypeTest::assertEquals
Open

        $this->assertEquals('oo_node_choice', $this->orchestraNodeChoiceType->getName());

Call to method mock from undeclared class \Phake
Open

        $resolver = Phake::mock('Symfony\Component\OptionsResolver\OptionsResolver');

Call to method when from undeclared class \Phake
Open

        Phake::when($this->node1)->getName()->thenReturn($this->nodeName1);

Call to method mock from undeclared class \Phake
Open

        $this->node1 = Phake::mock('OpenOrchestra\ModelInterface\Model\NodeInterface');

Call to method when from undeclared class \Phake
Open

        Phake::when($this->node2)->getName()->thenReturn($this->nodeName2);

Parameter $options has undeclared type \Symfony\Component\OptionsResolver\Options
Open

                'choices' => function(Options $options) {

Call to method mock from undeclared class \Phake
Open

        $currentSiteManager = Phake::mock('OpenOrchestra\Backoffice\Context\ContextBackOfficeInterface');

Call to method when from undeclared class \Phake
Open

        Phake::when($this->node1)->getNodeId()->thenReturn($this->nodeNodeId1);

Call to method when from undeclared class \Phake
Open

        Phake::when($this->node2)->getNodeId()->thenReturn($this->nodeNodeId2);

Call to method when from undeclared class \Phake
Open

        Phake::when($this->nodeRepository)->findTreeNode(Phake::anyParameters())->thenReturn(

Suspicious array access to \Symfony\Component\OptionsResolver\Options
Open

                    return $this->getChoices($options['siteId']);

Call to undeclared method \OpenOrchestra\Backoffice\Tests\Form\Type\Component\NodeChoiceTypeTest::getChoices
Open

                    return $this->getChoices($options['siteId']);

Call to method mock from undeclared class \Phake
Open

        $this->nodeRepository = Phake::mock('OpenOrchestra\ModelInterface\Repository\NodeRepositoryInterface');

Class extends undeclared class \OpenOrchestra\BaseBundle\Tests\AbstractTest\AbstractBaseTestCase
Open

class NodeChoiceTypeTest extends AbstractBaseTestCase

Call to method anyParameters from undeclared class \Phake
Open

        Phake::when($this->nodeRepository)->findTreeNode(Phake::anyParameters())->thenReturn(

Call to undeclared method \OpenOrchestra\Backoffice\Tests\Form\Type\Component\NodeChoiceTypeTest::assertEquals
Open

        $this->assertEquals('choice', $this->orchestraNodeChoiceType->getParent());

Avoid excessively long variable names like $orchestraNodeChoiceType. Keep variable name length under 20.
Open

    protected $orchestraNodeChoiceType;

LongVariable

Since: 0.2

Detects when a field, formal or local variable is declared with a long name.

Example

class Something {
    protected $reallyLongIntName = -3; // VIOLATION - Field
    public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

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

Expected 1 space after FUNCTION keyword; 0 found
Open

                'choices' => function(Options $options) {

Closing parenthesis of a multi-line function call must be on a line by itself
Open

        ));

There are no issues that match your filters.

Category
Status