open-orchestra/open-orchestra-cms-bundle

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

Summary

Maintainability
A
0 mins
Test Coverage

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

        $resolverMock = 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

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

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->keyword1 = Phake::mock('OpenOrchestra\ModelInterface\Model\KeywordInterface');

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->keywordRepository = Phake::mock('OpenOrchestra\ModelInterface\Repository\KeywordRepositoryInterface');

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->conditionToReferenceKeywordTransformer = Phake::mock('OpenOrchestra\Backoffice\Form\DataTransformer\ConditionToReferenceKeywordTransformer');

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

        Phake::when($this->authorizationChecker)->isGranted(Phake::anyParameters())->thenReturn(true);

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->csvToReferenceKeywordTransformer = Phake::mock('OpenOrchestra\Backoffice\Form\DataTransformer\CsvToReferenceKeywordTransformer');

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->builder = Phake::mock('Symfony\Component\Form\FormBuilder');

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->authorizationChecker = Phake::mock('Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface');

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->router)->generate(Phake::anyParameters())->thenReturn($route);

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->router = Phake::mock('Symfony\Component\Routing\RouterInterface');

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

        $this->keywords->add($this->keyword1);

Call to method when from undeclared class \Phake
Open

        Phake::when($this->keywordRepository)->findAll()->thenReturn($this->keywords);

Call to method when from undeclared class \Phake
Open

        Phake::when($this->router)->generate(Phake::anyParameters())->thenReturn($route);

Call to method mock from undeclared class \Phake
Open

        $this->conditionToReferenceKeywordTransformer = Phake::mock('OpenOrchestra\Backoffice\Form\DataTransformer\ConditionToReferenceKeywordTransformer');

Call to method verify from undeclared class \Phake
Open

        Phake::verify($this->builder)->addModelTransformer($this->csvToReferenceKeywordTransformer);

Call to method mock from undeclared class \Phake
Open

        $this->builder = Phake::mock('Symfony\Component\Form\FormBuilder');

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

            'attr' => function(Options $options) use ($isGranted, $tagLabel, $route) {

Call to method mock from undeclared class \Phake
Open

        $this->authorizationChecker = Phake::mock('Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface');

Call to method mock from undeclared class \Phake
Open

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

Call to method mock from undeclared class \Phake
Open

        $this->csvToReferenceKeywordTransformer = Phake::mock('OpenOrchestra\Backoffice\Form\DataTransformer\CsvToReferenceKeywordTransformer');

Call to method anyParameters from undeclared class \Phake
Open

        Phake::when($this->authorizationChecker)->isGranted(Phake::anyParameters())->thenReturn(true);

Assigning \OpenOrchestra\Backoffice\Form\Type\Component\KeywordsChoiceType to property but \OpenOrchestra\Backoffice\Tests\Form\Type\Component\KeywordsChoiceTypeTest->form is \OpenOrchestra\Backoffice\Tests\Form\Type\Component\KeywordsChoiceTypeTest
Open

        $this->form = new KeywordsChoiceType($this->csvToReferenceKeywordTransformer, $this->conditionToReferenceKeywordTransformer, $this->keywordRepository, $this->router, $this->authorizationChecker);

Call to undeclared method \OpenOrchestra\Backoffice\Tests\Form\Type\Component\KeywordsChoiceTypeTest::assertSame
Open

        $this->assertSame('oo_keywords_choice', $this->form->getName());

Call to undeclared method \OpenOrchestra\Backoffice\Tests\Form\Type\Component\KeywordsChoiceTypeTest::assertSame
Open

        $this->assertSame('text', $this->form->getParent());

Call to method verify from undeclared class \Phake
Open

        Phake::verify($resolverMock)->setDefaults(array(

Call to undeclared method \OpenOrchestra\Backoffice\Tests\Form\Type\Component\KeywordsChoiceTypeTest::buildForm
Open

        $this->form->buildForm($this->builder, array('is_condition' => true));

Call to method verify from undeclared class \Phake
Open

        Phake::verify($this->builder)->addModelTransformer($this->conditionToReferenceKeywordTransformer);

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

class KeywordsChoiceTypeTest extends AbstractBaseTestCase

Call to method mock from undeclared class \Phake
Open

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

Call to undeclared method \OpenOrchestra\Backoffice\Tests\Form\Type\Component\KeywordsChoiceTypeTest::getParent (Did you mean expr->testParent())
Open

        $this->assertSame('text', $this->form->getParent());

Call to undeclared method \OpenOrchestra\Backoffice\Tests\Form\Type\Component\KeywordsChoiceTypeTest::configureOptions
Open

        $this->form->configureOptions($resolverMock);

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

                return array_replace($default, $options['new_attr']);

Call to method mock from undeclared class \Phake
Open

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

Call to method mock from undeclared class \Phake
Open

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

Call to method mock from undeclared class \Phake
Open

        $this->router = Phake::mock('Symfony\Component\Routing\RouterInterface');

Call to undeclared method \OpenOrchestra\Backoffice\Tests\Form\Type\Component\KeywordsChoiceTypeTest::buildForm
Open

        $this->form->buildForm($this->builder, array('is_condition' => false));

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

        $this->keywords->add($this->keyword2);

Call to method when from undeclared class \Phake
Open

        Phake::when($this->authorizationChecker)->isGranted(Phake::anyParameters())->thenReturn(true);

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

        $this->keywords = new ArrayCollection();

Call to method anyParameters from undeclared class \Phake
Open

        Phake::when($this->router)->generate(Phake::anyParameters())->thenReturn($route);

Call to undeclared method \OpenOrchestra\Backoffice\Tests\Form\Type\Component\KeywordsChoiceTypeTest::getName (Did you mean expr->testName())
Open

        $this->assertSame('oo_keywords_choice', $this->form->getName());

Call to method when from undeclared class \Phake
Open

        Phake::when($this->keyword1)->getLabel()->thenReturn($tagLabel);

Call to method when from undeclared class \Phake
Open

        Phake::when($this->keyword2)->getLabel()->thenReturn($tagLabel);

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

    protected $csvToReferenceKeywordTransformer;

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

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

    protected $keywordToDocumentManager;

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

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

    protected $conditionToReferenceKeywordTransformer;

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

            'attr' => function(Options $options) use ($isGranted, $tagLabel, $route) {

Line exceeds 120 characters; contains 144 characters
Open

        $this->csvToReferenceKeywordTransformer = Phake::mock('OpenOrchestra\Backoffice\Form\DataTransformer\CsvToReferenceKeywordTransformer');

Line exceeds 120 characters; contains 156 characters
Open

        $this->conditionToReferenceKeywordTransformer = Phake::mock('OpenOrchestra\Backoffice\Form\DataTransformer\ConditionToReferenceKeywordTransformer');

Line exceeds 120 characters; contains 129 characters
Open

        $this->authorizationChecker = Phake::mock('Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface');

Line exceeds 120 characters; contains 203 characters
Open

        $this->form = new KeywordsChoiceType($this->csvToReferenceKeywordTransformer, $this->conditionToReferenceKeywordTransformer, $this->keywordRepository, $this->router, $this->authorizationChecker);

There are no issues that match your filters.

Category
Status