open-orchestra/open-orchestra-cms-bundle

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

Summary

Maintainability
A
0 mins
Test Coverage

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

        $content1 = Phake::mock('OpenOrchestra\ModelInterface\Model\ContentInterface');

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

        $referenceToEmbedTransformer = Phake::mock('OpenOrchestra\Backoffice\Form\DataTransformer\ReferenceToEmbedTransformer');

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

        $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 'testBuildForm'.
Open

        $builder = Phake::mock('Symfony\Component\Form\FormBuilderInterface');

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

        $contentRepository = Phake::mock('OpenOrchestra\ModelInterface\Repository\ContentRepositoryInterface');

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

        $contextManager = 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 'setUp'.
Open

        $content0 = Phake::mock('OpenOrchestra\ModelInterface\Model\ContentInterface');

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 add from undeclared class \Doctrine\Common\Collections\ArrayCollection
Open

        $contents->add($content0);

Call to method when from undeclared class \Phake
Open

        Phake::when($content0)->getName()->thenReturn($this->contentName0);

Call to method mock from undeclared class \Phake
Open

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

Call to method verify from undeclared class \Phake
Open

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

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

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

Call to method mock from undeclared class \Phake
Open

        $contentRepository = Phake::mock('OpenOrchestra\ModelInterface\Repository\ContentRepositoryInterface');

Call to method when from undeclared class \Phake
Open

        Phake::when($contextManager)->getSiteDefaultLanguage()->thenReturn($this->language);

Call to method when from undeclared class \Phake
Open

        Phake::when($content0)->getId()->thenReturn($this->contentId0);

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($content1)->getId()->thenReturn($this->contentId1);

Call to method mock from undeclared class \Phake
Open

        $referenceToEmbedTransformer = Phake::mock('OpenOrchestra\Backoffice\Form\DataTransformer\ReferenceToEmbedTransformer');

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

class ContentChoiceTypeTest extends AbstractBaseTestCase

Call to method add from undeclared class \Doctrine\Common\Collections\ArrayCollection
Open

        $contents->add($content1);

Call to method when from undeclared class \Phake
Open

        Phake::when($content1)->getName()->thenReturn($this->contentName1);

Call to method when from undeclared class \Phake
Open

        Phake::when($contentRepository)->findByContentTypeAndCondition($this->language, $this->contentType, $this->choiceType, $this->keyword, $this->siteId)->thenReturn($contents);

Call to method when from undeclared class \Phake
Open

        Phake::when($contextManager)->getSiteId()->thenReturn($this->siteId);

Call to method mock from undeclared class \Phake
Open

        $content0 = Phake::mock('OpenOrchestra\ModelInterface\Model\ContentInterface');

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

        $this->assertEquals('oo_content_choice', $this->form->getName());

Call to method verify from undeclared class \Phake
Open

        Phake::verify($builder)->add($this->formTypeName, 'choice', array(

Call to method mock from undeclared class \Phake
Open

        $content1 = Phake::mock('OpenOrchestra\ModelInterface\Model\ContentInterface');

Call to method __construct from undeclared class \Doctrine\Common\Collections\ArrayCollection
Open

        $contents = new ArrayCollection();

Reference to constant CHOICE_AND from undeclared class \OpenOrchestra\ModelInterface\Repository\ReadContentRepositoryInterface
Open

                    'choiceType' => ReadContentRepositoryInterface::CHOICE_AND,

Call to method mock from undeclared class \Phake
Open

        $builder = Phake::mock('Symfony\Component\Form\FormBuilderInterface');

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

        $referenceToEmbedTransformer = Phake::mock('OpenOrchestra\Backoffice\Form\DataTransformer\ReferenceToEmbedTransformer');

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

The closing brace for the class must go on the next line after the body
Open

}

Line exceeds 120 characters; contains 128 characters
Open

        $referenceToEmbedTransformer = Phake::mock('OpenOrchestra\Backoffice\Form\DataTransformer\ReferenceToEmbedTransformer');

Line exceeds 120 characters; contains 132 characters
Open

        $this->form = new ContentChoiceType($contentRepository, $contextManager, $referenceToEmbedTransformer, $this->formTypeName);

Line exceeds 120 characters; contains 181 characters
Open

        Phake::when($contentRepository)->findByContentTypeAndCondition($this->language, $this->contentType, $this->choiceType, $this->keyword, $this->siteId)->thenReturn($contents);

Opening parenthesis of a multi-line function call must be the last content on the line
Open

        $this->form->buildForm($builder,

Expected 0 spaces before closing bracket; newline found
Open

        Phake::verify($builder)->add($this->formTypeName, 'choice', array(

There are no issues that match your filters.

Category
Status