open-orchestra/open-orchestra-cms-bundle

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

Summary

Maintainability
A
1 hr
Test Coverage

Method testBuildView has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function testBuildView()
    {
        $resolvedFormType = Phake::mock('Symfony\Component\Form\ResolvedFormTypeInterface');
        Phake::when($resolvedFormType)->getName()->thenReturn('collection');

Severity: Minor
Found in Backoffice/Tests/Form/Type/Extension/AccordionExtensionTest.php - About 1 hr to fix

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

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

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

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

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

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

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

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

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

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

Call to method when from undeclared class \Phake
Open

        Phake::when($form)->has('fakeNonExistingColumn')->thenReturn(false);

Call to method when from undeclared class \Phake
Open

        Phake::when($formConfig)->getType()->thenReturn($resolvedFormType);

Call to method when from undeclared class \Phake
Open

        Phake::when($resolvedFormType)->getName()->thenReturn('collection');

Call to method mock from undeclared class \Phake
Open

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

Call to method when from undeclared class \Phake
Open

        Phake::when($formColumn0Config)->getOption('label')->thenReturn('fakeColumn0Label');

Call to method when from undeclared class \Phake
Open

        Phake::when($formColumn0)->getConfig()->thenReturn($formColumn0Config);

Call to method when from undeclared class \Phake
Open

        Phake::when($formConfig)->getOption('columns')->thenReturn(array('fakeColumn0', 'fakeColumn1', 'fakeNonExistingColumn'));

Call to method when from undeclared class \Phake
Open

        Phake::when($form)->has('fakeColumn0')->thenReturn(true);

Call to method mock from undeclared class \Phake
Open

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

Call to method when from undeclared class \Phake
Open

        Phake::when($formColumn1)->getData()->thenReturn('fakeColumn1Data');

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($form)->getParent()->thenReturn($form);

Call to method mock from undeclared class \Phake
Open

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

Call to method mock from undeclared class \Phake
Open

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

Call to method when from undeclared class \Phake
Open

        Phake::when($formColumn1)->getConfig()->thenReturn($formColumn1Config);

Call to method mock from undeclared class \Phake
Open

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

Call to method when from undeclared class \Phake
Open

        Phake::when($form)->get('fakeColumn1')->thenReturn($formColumn1);

Call to method when from undeclared class \Phake
Open

        Phake::when($formColumn0)->getData()->thenReturn('fakeColumn0Data');

Call to method mock from undeclared class \Phake
Open

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

Call to method mock from undeclared class \Phake
Open

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

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

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

Call to method when from undeclared class \Phake
Open

        Phake::when($form)->get('fakeColumn0')->thenReturn($formColumn0);

Call to method when from undeclared class \Phake
Open

        Phake::when($form)->has('fakeColumn1')->thenReturn(true);

Call to method when from undeclared class \Phake
Open

        Phake::when($formColumn1Config)->getOption('label')->thenReturn('fakeColumn1Label');

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

        $this->assertEquals($formView->vars['columns'], array(

Call to method when from undeclared class \Phake
Open

        Phake::when($form)->getConfig()->thenReturn($formConfig);

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

class AccordionExtensionTest extends AbstractBaseTestCase

Line exceeds 120 characters; contains 129 characters
Open

        Phake::when($formConfig)->getOption('columns')->thenReturn(array('fakeColumn0', 'fakeColumn1', 'fakeNonExistingColumn'));

There are no issues that match your filters.

Category
Status