open-orchestra/open-orchestra-cms-bundle

View on GitHub
GroupBundle/Tests/Form/Type/GroupElementTypeTest.php

Summary

Maintainability
A
0 mins
Test Coverage

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

        Phake::when($builder)->add(Phake::anyParameters())->thenReturn($builder);

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 'provideGroup'.
Open

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

        $formInterface = Phake::mock('Symfony\Component\Form\FormInterface');

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 'provideGroup'.
Open

        $group0 = Phake::mock('OpenOrchestra\Backoffice\Model\GroupInterface');

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 'provideGroup'.
Open

        Phake::when($groupRepository0)->find(Phake::anyParameters())->thenReturn($group0);

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 'testBuilder'.
Open

        Phake::when($builder)->addEventSubscriber(Phake::anyParameters())->thenReturn($builder);

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 'testBuildView'.
Open

        $formView = Phake::mock('Symfony\Component\Form\FormView');

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 'testBuilder'.
Open

        Phake::verify($builder, Phake::times(1))->add(Phake::anyParameters());

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

        $groupRepository = Phake::mock('OpenOrchestra\GroupBundle\Repository\GroupRepository');

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 'provideGroup'.
Open

        $groupRepository1 = Phake::mock('OpenOrchestra\GroupBundle\Repository\GroupRepository');

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 'provideGroup'.
Open

        $group1 = Phake::mock('OpenOrchestra\Backoffice\Model\GroupInterface');

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 'testBuildView'.
Open

        $multiLanguagesChoiceManager = Phake::mock('OpenOrchestra\ModelInterface\Manager\MultiLanguagesChoiceManagerInterface');

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 'testBuildView'.
Open

        Phake::when($multiLanguagesChoiceManager)->choose(Phake::anyParameters())->thenReturn('fakeLabel');

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

        $multiLanguagesChoiceManager = Phake::mock('OpenOrchestra\ModelInterface\Manager\MultiLanguagesChoiceManagerInterface');

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 'provideGroup'.
Open

        $site = Phake::mock('OpenOrchestra\ModelInterface\Model\SiteInterface');

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 'provideGroup'.
Open

        Phake::when($groupRepository)->find(Phake::anyParameters())->thenReturn(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 '\Phake' in method 'setUp'.
Open

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

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

        $groupRepository = Phake::mock('OpenOrchestra\GroupBundle\Repository\GroupRepository');

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 'testBuilder'.
Open

        Phake::verify($builder, Phake::times(1))->add(Phake::anyParameters());

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 'provideGroup'.
Open

        $groupRepository0 = Phake::mock('OpenOrchestra\GroupBundle\Repository\GroupRepository');

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 'provideGroup'.
Open

        Phake::when($groupRepository1)->find(Phake::anyParameters())->thenReturn($group1);

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 anyParameters from undeclared class \Phake
Open

        Phake::verify($builder, Phake::times(1))->add(Phake::anyParameters());

Call to method times from undeclared class \Phake
Open

        Phake::verify($builder, Phake::times(1))->add(Phake::anyParameters());

Call to method mock from undeclared class \Phake
Open

        $group1 = Phake::mock('OpenOrchestra\Backoffice\Model\GroupInterface');

Call to method mock from undeclared class \Phake
Open

        $groupRepository1 = Phake::mock('OpenOrchestra\GroupBundle\Repository\GroupRepository');

Call to method anyParameters from undeclared class \Phake
Open

        Phake::when($multiLanguagesChoiceManager)->choose(Phake::anyParameters())->thenReturn('fakeLabel');

Call to method when from undeclared class \Phake
Open

        Phake::when($group0)->getSite()->thenReturn($site);

Call to method when from undeclared class \Phake
Open

        Phake::when($group0)->isDeleted()->thenReturn(false);

Call to method mock from undeclared class \Phake
Open

        $formView = Phake::mock('Symfony\Component\Form\FormView');

Call to method when from undeclared class \Phake
Open

        Phake::when($site)->getName()->thenReturn('fakeName');

Call to method when from undeclared class \Phake
Open

        Phake::when($group0)->getLabels()->thenReturn(array());

Call to method when from undeclared class \Phake
Open

        Phake::when($groupRepository0)->find(Phake::anyParameters())->thenReturn($group0);

Call to method anyParameters from undeclared class \Phake
Open

        Phake::when($builder)->add(Phake::anyParameters())->thenReturn($builder);

Call to method anyParameters from undeclared class \Phake
Open

        Phake::when($builder)->addEventSubscriber(Phake::anyParameters())->thenReturn($builder);

Call to method mock from undeclared class \Phake
Open

        $site = Phake::mock('OpenOrchestra\ModelInterface\Model\SiteInterface');

Call to method mock from undeclared class \Phake
Open

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

Call to undeclared method \OpenOrchestra\GroupBundle\Tests\Form\Type\GroupElementTypeTest::assertEquals
Open

        $this->assertEquals($formView->vars['parameters'], $expectedParameters);

Call to method when from undeclared class \Phake
Open

        Phake::when($groupRepository)->find(Phake::anyParameters())->thenReturn(null);

Call to method when from undeclared class \Phake
Open

        Phake::when($group1)->getSite()->thenReturn($site);

Call to method when from undeclared class \Phake
Open

        Phake::when($group1)->isDeleted()->thenReturn(true);

Call to method when from undeclared class \Phake
Open

        Phake::when($groupRepository1)->find(Phake::anyParameters())->thenReturn($group1);

Call to method mock from undeclared class \Phake
Open

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

Call to method mock from undeclared class \Phake
Open

        $groupRepository = Phake::mock('OpenOrchestra\GroupBundle\Repository\GroupRepository');

Call to undeclared method \OpenOrchestra\GroupBundle\Tests\Form\Type\GroupElementTypeTest::assertInstanceOf
Open

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

Call to method verify from undeclared class \Phake
Open

        Phake::verify($builder, Phake::times(1))->add(Phake::anyParameters());

Call to method mock from undeclared class \Phake
Open

        $formInterface = Phake::mock('Symfony\Component\Form\FormInterface');

Call to method anyParameters from undeclared class \Phake
Open

        Phake::when($groupRepository)->find(Phake::anyParameters())->thenReturn(null);

Call to method mock from undeclared class \Phake
Open

        $group0 = Phake::mock('OpenOrchestra\Backoffice\Model\GroupInterface');

Call to method mock from undeclared class \Phake
Open

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

Call to method when from undeclared class \Phake
Open

        Phake::when($authorizationChecker)->isGranted(ContributionActionInterface::READ, $group1)->thenReturn(false);

Call to method mock from undeclared class \Phake
Open

        $multiLanguagesChoiceManager = Phake::mock('OpenOrchestra\ModelInterface\Manager\MultiLanguagesChoiceManagerInterface');

Call to method mock from undeclared class \Phake
Open

        $groupRepository0 = Phake::mock('OpenOrchestra\GroupBundle\Repository\GroupRepository');

Call to method when from undeclared class \Phake
Open

        Phake::when($multiLanguagesChoiceManager)->choose(Phake::anyParameters())->thenReturn('fakeLabel');

Call to method anyParameters from undeclared class \Phake
Open

        Phake::when($groupRepository0)->find(Phake::anyParameters())->thenReturn($group0);

Call to method anyParameters from undeclared class \Phake
Open

        Phake::when($groupRepository1)->find(Phake::anyParameters())->thenReturn($group1);

Call to method when from undeclared class \Phake
Open

        Phake::when($authorizationChecker)->isGranted(ContributionActionInterface::READ, $group0)->thenReturn(true);

Possibly zero references to use statement for classlike/namespace GroupInterface (\OpenOrchestra\Backoffice\Model\GroupInterface)
Open

use OpenOrchestra\Backoffice\Model\GroupInterface;

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

class GroupElementTypeTest extends AbstractBaseTestCase

Call to method mock from undeclared class \Phake
Open

        $multiLanguagesChoiceManager = Phake::mock('OpenOrchestra\ModelInterface\Manager\MultiLanguagesChoiceManagerInterface');

Parameter $authorizationChecker has undeclared type \Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface
Open

    public function testBuildView(GroupRepository $groupRepository, AuthorizationCheckerInterface $authorizationChecker, array $expectedParameters)

Call to method when from undeclared class \Phake
Open

        Phake::when($group1)->getLabels()->thenReturn(array());

Call to undeclared method \OpenOrchestra\GroupBundle\Tests\Form\Type\GroupElementTypeTest::assertSame
Open

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

Call to method when from undeclared class \Phake
Open

        Phake::when($builder)->add(Phake::anyParameters())->thenReturn($builder);

Call to method when from undeclared class \Phake
Open

        Phake::when($builder)->addEventSubscriber(Phake::anyParameters())->thenReturn($builder);

Call to method mock from undeclared class \Phake
Open

        $groupRepository = Phake::mock('OpenOrchestra\GroupBundle\Repository\GroupRepository');

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

        $multiLanguagesChoiceManager = Phake::mock('OpenOrchestra\ModelInterface\Manager\MultiLanguagesChoiceManagerInterface');

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 $multiLanguagesChoiceManager. Keep variable name length under 20.
Open

        $multiLanguagesChoiceManager = Phake::mock('OpenOrchestra\ModelInterface\Manager\MultiLanguagesChoiceManagerInterface');

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

Line exceeds 120 characters; contains 128 characters
Open

        $multiLanguagesChoiceManager = Phake::mock('OpenOrchestra\ModelInterface\Manager\MultiLanguagesChoiceManagerInterface');

Line exceeds 120 characters; contains 175 characters
Open

            "allowed" => array($groupRepository0, $authorizationChecker, array('groupName' => 'fakeLabel', 'siteName' => 'fakeName', 'deleted' => false, 'disabled' => false)),

Line exceeds 120 characters; contains 147 characters
Open

    public function testBuildView(GroupRepository $groupRepository, AuthorizationCheckerInterface $authorizationChecker, array $expectedParameters)

Line exceeds 120 characters; contains 128 characters
Open

        $multiLanguagesChoiceManager = Phake::mock('OpenOrchestra\ModelInterface\Manager\MultiLanguagesChoiceManagerInterface');

Line exceeds 120 characters; contains 181 characters
Open

            "prototype" => array($groupRepository, $authorizationChecker, array('groupName' => '__label__', 'siteName' => '__site.name__', 'deleted' => false, 'disabled' => false)),

Line exceeds 120 characters; contains 123 characters
Open

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

Line exceeds 120 characters; contains 123 characters
Open

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

Line exceeds 120 characters; contains 176 characters
Open

            "disallowed" => array($groupRepository1, $authorizationChecker, array('groupName' => 'fakeLabel', 'siteName' => 'fakeName', 'deleted' => true, 'disabled' => true)),

There are no issues that match your filters.

Category
Status