open-orchestra/open-orchestra-cms-bundle

View on GitHub
Backoffice/Tests/Form/Type/Extension/FormTypeGroupExtensionTest.php

Summary

Maintainability
B
4 hrs
Test Coverage

Method provideOptions has 105 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function provideOptions()
    {
        return array(
            array(false, array(), array(), array(), array(), array()),
            array(true, array(), array(), array(), array(), array()),
Severity: Major
Found in Backoffice/Tests/Form/Type/Extension/FormTypeGroupExtensionTest.php - About 4 hrs to fix

Method testBuildView has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    public function testBuildView($groupEnabled, array $groupIds, array $subGroupIds, array $groupRender, array $subGroupRender, array $expectedResult)
Severity: Minor
Found in Backoffice/Tests/Form/Type/Extension/FormTypeGroupExtensionTest.php - About 45 mins to fix

The method provideOptions() has 108 lines of code. Current threshold is set to 100. Avoid really long methods.
Open

    public function provideOptions()
    {
        return array(
            array(false, array(), array(), array(), array(), array()),
            array(true, array(), array(), array(), array(), array()),

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

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

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

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

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

            $childFormInterface = 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 '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 '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

Call to method mock from undeclared class \Phake
Open

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

Call to method verify from undeclared class \Phake
Open

        Phake::verify($builder)->setAttribute('group_enabled', 'group_enabled');

Call to method mock from undeclared class \Phake
Open

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

Call to method when from undeclared class \Phake
Open

        Phake::when($formInterface)->all()->thenReturn($children);

Call to method when from undeclared class \Phake
Open

        Phake::when($config)->getAttribute('sub_group_render')->thenReturn($subGroupRender);

Call to method when from undeclared class \Phake
Open

        Phake::when($formInterface)->getConfig()->thenReturn($config);

Call to method mock from undeclared class \Phake
Open

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

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

class FormTypeGroupExtensionTest extends AbstractBaseTestCase

Call to method mock from undeclared class \Phake
Open

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

Call to method when from undeclared class \Phake
Open

            Phake::when($childFormInterface)->getName()->thenReturn($key);

Call to method verify from undeclared class \Phake
Open

        Phake::verify($builder)->setAttribute('group_id', 'group_id');

Call to method verify from undeclared class \Phake
Open

        Phake::verify($builder)->setAttribute('group_render', 'group_render');

Call to method when from undeclared class \Phake
Open

        Phake::when($config)->getAttribute('group_enabled')->thenReturn($groupEnabled);

Call to method when from undeclared class \Phake
Open

            Phake::when($childFormInterface)->getConfig()->thenReturn($childConfig);

Call to method mock from undeclared class \Phake
Open

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

Call to undeclared method \OpenOrchestra\Backoffice\Tests\Form\Type\extension\FormTypeGroupExtensionTest::assertEquals
Open

        $this->assertEquals($formView->vars['group_enabled'], $groupEnabled);

Call to method verify from undeclared class \Phake
Open

        Phake::verify($builder)->setAttribute('sub_group_render', 'sub_group_render');

Call to method when from undeclared class \Phake
Open

        Phake::when($config)->getAttribute('group_render')->thenReturn($groupRender);

Call to method when from undeclared class \Phake
Open

            Phake::when($childConfig)->getAttribute('sub_group_id')->thenReturn($subGroupIds[$key]);

Call to undeclared method \OpenOrchestra\Backoffice\Tests\Form\Type\extension\FormTypeGroupExtensionTest::assertEquals
Open

            $this->assertEquals($formView->vars['group'], $expectedResult);

Call to method mock from undeclared class \Phake
Open

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

Call to undeclared method \OpenOrchestra\Backoffice\Tests\Form\Type\extension\FormTypeGroupExtensionTest::assertSame
Open

        $this->assertSame('form', $this->formExtension->getExtendedType());

Call to method verify from undeclared class \Phake
Open

        Phake::verify($builder)->setAttribute('sub_group_id', 'sub_group_id');

Call to method when from undeclared class \Phake
Open

            Phake::when($childConfig)->getAttribute('group_id')->thenReturn($groupId);

Call to method verify from undeclared class \Phake
Open

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

Call to method mock from undeclared class \Phake
Open

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

Function closing brace must go on the next line following the body; found 1 blank lines before brace
Open

    }

Line exceeds 120 characters; contains 149 characters
Open

                array('tabulation0', 'tabulation0', 'tabulation0', 'tabulation1', 'tabulation1', 'noTabulationDefinition', 'noTabulationDefinition'),

Line exceeds 120 characters; contains 151 characters
Open

    public function testBuildView($groupEnabled, array $groupIds, array $subGroupIds, array $groupRender, array $subGroupRender, array $expectedResult)

Line exceeds 120 characters; contains 157 characters
Open

                array('fieldset0', 'fieldset0', 'tabulation0fieldset1', 'tabulation1fieldset1', 'tabulation1fieldset0', 'fieldset0', 'noFieldsetDefinition'),

There are no issues that match your filters.

Category
Status