open-orchestra/open-orchestra-cms-bundle

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

Summary

Maintainability
A
2 hrs
Test Coverage

Method testConfigureOptions has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function testConfigureOptions()
    {
        $resolver = Phake::mock('Symfony\Component\OptionsResolver\OptionsResolver');

        $this->form->configureOptions($resolver);
Severity: Minor
Found in GroupBundle/Tests/Form/Type/GroupTypeTest.php - About 1 hr to fix

Method testBuilder has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    public function testBuilder($creation, $formTimes, $transformerTimes, $subscriberTimes, $dispatcherTimes)
Severity: Minor
Found in GroupBundle/Tests/Form/Type/GroupTypeTest.php - About 35 mins to fix

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

        $dataTransformer1 = Phake::mock('Symfony\Component\Form\DataTransformerInterface');

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

        Phake::verify($builder, Phake::times($subscriberTimes))->addEventSubscriber(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

        $dataTransformer0 = Phake::mock('Symfony\Component\Form\DataTransformerInterface');

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

        $site = Phake::mock('OpenOrchestra\ModelBundle\Document\Site');

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($this->eventDispatcher, Phake::times($dispatcherTimes))->dispatch(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 '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

        Phake::when($generatePerimeterManager)->getPerimetersConfiguration(Phake::anyParameters())->thenReturn(array());

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($transformerTimes))->addModelTransformer(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

        $this->eventDispatcher = Phake::mock('Symfony\Component\EventDispatcher\EventDispatcherInterface');

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

        $group = Phake::mock('OpenOrchestra\GroupBundle\Document\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

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

        Phake::verify($builder, Phake::times($formTimes))->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 'testBuilder'.
Open

        Phake::verify($builder, Phake::times($transformerTimes))->addModelTransformer(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 'testBuildView'.
Open

        $view = 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::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

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

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

        $eventSubscriber1 = Phake::mock('Symfony\Component\EventDispatcher\EventSubscriberInterface');

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

        $generatePerimeterManager = Phake::mock('OpenOrchestra\Backoffice\GeneratePerimeter\GeneratePerimeterManager');

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

        Phake::when($builder)->get(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 'testBuilder'.
Open

        Phake::verify($builder, Phake::times($subscriberTimes))->addEventSubscriber(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 '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 'testBuilder'.
Open

        Phake::verify($this->eventDispatcher, Phake::times($dispatcherTimes))->dispatch(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

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)->get(Phake::anyParameters())->thenReturn($builder);

Call to method mock from undeclared class \Phake
Open

        $site = Phake::mock('OpenOrchestra\ModelBundle\Document\Site');

Call to method when from undeclared class \Phake
Open

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

Call to method anyParameters from undeclared class \Phake
Open

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

Call to method mock from undeclared class \Phake
Open

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

Call to undeclared method \OpenOrchestra\GroupBundle\Tests\Form\Type\GroupTypeTest::assertFalse
Open

        $this->assertFalse($view->vars['new_button']);

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

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

Call to method anyParameters from undeclared class \Phake
Open

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

Call to method when from undeclared class \Phake
Open

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

Call to method times from undeclared class \Phake
Open

        Phake::verify($builder, Phake::times($subscriberTimes))->addEventSubscriber(Phake::anyParameters());

Call to method anyParameters from undeclared class \Phake
Open

        Phake::verify($this->eventDispatcher, Phake::times($dispatcherTimes))->dispatch(Phake::anyParameters());

Call to method times from undeclared class \Phake
Open

        Phake::verify($builder, Phake::times($transformerTimes))->addModelTransformer(Phake::anyParameters());

Call to method verify from undeclared class \Phake
Open

        Phake::verify($builder, Phake::times($subscriberTimes))->addEventSubscriber(Phake::anyParameters());

Call to method verify from undeclared class \Phake
Open

        Phake::verify($builder, Phake::times($transformerTimes))->addModelTransformer(Phake::anyParameters());

Call to method verify from undeclared class \Phake
Open

        Phake::verify($this->eventDispatcher, Phake::times($dispatcherTimes))->dispatch(Phake::anyParameters());

Call to method verify from undeclared class \Phake
Open

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

Call to undeclared method \OpenOrchestra\GroupBundle\Tests\Form\Type\GroupTypeTest::assertTrue
Open

        $this->assertTrue($view->vars['enable_delete_button']);

Call to method mock from undeclared class \Phake
Open

        $dataTransformer1 = Phake::mock('Symfony\Component\Form\DataTransformerInterface');

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

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

Call to method anyParameters from undeclared class \Phake
Open

        Phake::when($generatePerimeterManager)->getPerimetersConfiguration(Phake::anyParameters())->thenReturn(array());

Call to undeclared method \OpenOrchestra\GroupBundle\Tests\Form\Type\GroupTypeTest::assertTrue
Open

        $this->assertTrue($view->vars['delete_button']);

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

        $this->assertSame('test', $view->vars['delete_help_text']);

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

class GroupTypeTest extends AbstractBaseTestCase

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

        $group = Phake::mock('OpenOrchestra\GroupBundle\Document\Group');

Call to method times from undeclared class \Phake
Open

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

Call to method mock from undeclared class \Phake
Open

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

Call to method mock from undeclared class \Phake
Open

        $eventSubscriber1 = Phake::mock('Symfony\Component\EventDispatcher\EventSubscriberInterface');

Call to method anyParameters from undeclared class \Phake
Open

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

Call to method mock from undeclared class \Phake
Open

        $this->eventDispatcher = Phake::mock('Symfony\Component\EventDispatcher\EventDispatcherInterface');

Call to method verify from undeclared class \Phake
Open

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

Call to method times from undeclared class \Phake
Open

        Phake::verify($this->eventDispatcher, Phake::times($dispatcherTimes))->dispatch(Phake::anyParameters());

Call to method anyParameters from undeclared class \Phake
Open

        Phake::verify($builder, Phake::times($transformerTimes))->addModelTransformer(Phake::anyParameters());

Call to method anyParameters from undeclared class \Phake
Open

        Phake::verify($builder, Phake::times($subscriberTimes))->addEventSubscriber(Phake::anyParameters());

Call to method mock from undeclared class \Phake
Open

        $dataTransformer0 = Phake::mock('Symfony\Component\Form\DataTransformerInterface');

Call to method when from undeclared class \Phake
Open

        Phake::when($generatePerimeterManager)->getPerimetersConfiguration(Phake::anyParameters())->thenReturn(array());

Call to method mock from undeclared class \Phake
Open

        $generatePerimeterManager = Phake::mock('OpenOrchestra\Backoffice\GeneratePerimeter\GeneratePerimeterManager');

Call to method mock from undeclared class \Phake
Open

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

Call to method when from undeclared class \Phake
Open

        Phake::when($site)->getSiteId()->thenReturn('siteId');

Call to method mock from undeclared class \Phake
Open

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

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

        $generatePerimeterManager = Phake::mock('OpenOrchestra\Backoffice\GeneratePerimeter\GeneratePerimeterManager');

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

There are no issues that match your filters.

Category
Status