open-orchestra/open-orchestra-cms-bundle

View on GitHub
Backoffice/Tests/EventSubscriber/FieldTypeTypeSubscriberTest.php

Summary

Maintainability
A
2 hrs
Test Coverage

Method setUp has 51 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function setUp()
    {
        $this->fieldOptionClass = 'OpenOrchestra\ModelBundle\Document\FieldOption';
        $this->fieldTypeClass = 'OpenOrchestra\ModelBundle\Document\FieldType';
        $this->form = Phake::mock('Symfony\Component\Form\Form');
Severity: Major
Found in Backoffice/Tests/EventSubscriber/FieldTypeTypeSubscriberTest.php - About 2 hrs to fix

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

        $parent = 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 'testPreSetData'.
Open

        $fieldType = Phake::mock('OpenOrchestra\ModelInterface\Model\FieldTypeInterface');

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

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->containerChild = 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

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

        $fieldOption = Phake::mock('OpenOrchestra\ModelInterface\Model\FieldOptionInterface');

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->optionsChild = 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 'testPreSubmit'.
Open

        $fieldType = Phake::mock('OpenOrchestra\ModelInterface\Model\FieldTypeInterface');

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

        $optionChild = 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 'testPreSetData'.
Open

        $fieldOption = Phake::mock('OpenOrchestra\ModelInterface\Model\FieldOptionInterface');

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->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

Call to undeclared method \OpenOrchestra\Backoffice\Tests\EventSubscriber\FieldTypeTypeSubscriberTest::assertInstanceOf
Open

        $this->assertInstanceOf('Symfony\Component\EventDispatcher\EventSubscriberInterface', $this->subscriber);

Call to method verify from undeclared class \Phake
Open

        Phake::verify($this->containerChild)->add(

Call to method when from undeclared class \Phake
Open

        Phake::when($fieldOption)->getValue()->thenReturn($optionValue);

Call to method mock from undeclared class \Phake
Open

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

Call to method when from undeclared class \Phake
Open

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

Call to method when from undeclared class \Phake
Open

        Phake::when($fieldOption)->getKey()->thenReturn('max_length');

Call to method when from undeclared class \Phake
Open

        Phake::when($this->event)->getData()->thenReturn($fieldType);

Call to method verify from undeclared class \Phake
Open

        Phake::verify($this->containerChild)->add(

Call to method verify from undeclared class \Phake
Open

        Phake::verify($this->containerChild)->remove('default_value');

Call to method mock from undeclared class \Phake
Open

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

Call to method mock from undeclared class \Phake
Open

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

Call to method when from undeclared class \Phake
Open

        Phake::when($this->optionsChild)->all()->thenReturn(array(

Call to method when from undeclared class \Phake
Open

        Phake::when($fieldOption)->getValue()->thenReturn($optionValue);

Call to method when from undeclared class \Phake
Open

        Phake::when($fieldType)->getType()->thenReturn('text');

Call to method when from undeclared class \Phake
Open

        Phake::when($fieldType)->getOptions()->thenReturn(array($fieldOption));

Call to method mock from undeclared class \Phake
Open

        $fieldType = Phake::mock('OpenOrchestra\ModelInterface\Model\FieldTypeInterface');

Call to method when from undeclared class \Phake
Open

        Phake::when($fieldType)->getOptions()->thenReturn(array($fieldOption));

Call to method verify from undeclared class \Phake
Open

        Phake::verify($this->optionsChild)->add('required', 'choice', array("search" => 'boolean', 'data' => false));

Call to method when from undeclared class \Phake
Open

        Phake::when($this->containerChild)->has('default_value')->thenReturn(true);

Call to method when from undeclared class \Phake
Open

        Phake::when($optionChild)->getName()->thenReturn($this->optionChildName);

Call to method when from undeclared class \Phake
Open

        Phake::when($this->form)->get('options')->thenReturn($this->optionsChild);

Call to undeclared method \OpenOrchestra\Backoffice\Tests\EventSubscriber\FieldTypeTypeSubscriberTest::assertArrayHasKey
Open

        $this->assertArrayHasKey(FormEvents::PRE_SUBMIT, $this->subscriber->getSubscribedEvents());

Call to method mock from undeclared class \Phake
Open

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

Call to method mock from undeclared class \Phake
Open

        $fieldType = Phake::mock('OpenOrchestra\ModelInterface\Model\FieldTypeInterface');

Call to method when from undeclared class \Phake
Open

        Phake::when($this->event)->getForm()->thenReturn($this->form);

Call to method when from undeclared class \Phake
Open

        Phake::when($this->form)->get('container')->thenReturn($this->containerChild);

Call to method mock from undeclared class \Phake
Open

        $fieldOption = Phake::mock('OpenOrchestra\ModelInterface\Model\FieldOptionInterface');

Call to method verify from undeclared class \Phake
Open

        Phake::verify($this->optionsChild)->add('required', 'choice', array("search" => 'boolean', 'data' => false));

Call to method when from undeclared class \Phake
Open

        Phake::when($config)->getMethod()->thenReturn('POST');

Call to method when from undeclared class \Phake
Open

        Phake::when($this->form)->getRoot()->thenReturn($parent);

Call to method when from undeclared class \Phake
Open

        Phake::when($fieldType)->getType()->thenReturn('text');

Call to method when from undeclared class \Phake
Open

        Phake::when($fieldType)->getDefaultValue()->thenReturn($defaultValue);

Call to method verify from undeclared class \Phake
Open

        Phake::verify($this->containerChild)->remove('default_value');

Call to method when from undeclared class \Phake
Open

        Phake::when($fieldType)->getDefaultValue()->thenReturn($defaultValue);

Call to method verify from undeclared class \Phake
Open

        Phake::verify($this->optionsChild)->add('max_length', 'text', array("search" => 'text', 'data' => $optionValue));

Call to method mock from undeclared class \Phake
Open

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

Call to undeclared method \OpenOrchestra\Backoffice\Tests\EventSubscriber\FieldTypeTypeSubscriberTest::assertArrayHasKey
Open

        $this->assertArrayHasKey(FormEvents::PRE_SET_DATA, $this->subscriber->getSubscribedEvents());

Call to method when from undeclared class \Phake
Open

        Phake::when($this->event)->getForm()->thenReturn($this->form);

Call to method verify from undeclared class \Phake
Open

        Phake::verify($this->optionsChild)->add('max_length', 'text', array("search" => 'text', 'data' => $optionValue));

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

class FieldTypeTypeSubscriberTest extends AbstractBaseTestCase

Call to method when from undeclared class \Phake
Open

        Phake::when($fieldOption)->getKey()->thenReturn('max_length');

Call to method when from undeclared class \Phake
Open

        Phake::when($this->form)->getData()->thenReturn($fieldType);

Call to method mock from undeclared class \Phake
Open

        $fieldOption = Phake::mock('OpenOrchestra\ModelInterface\Model\FieldOptionInterface');

Call to method when from undeclared class \Phake
Open

        Phake::when($this->event)->getData()->thenReturn(array('type' => 'text'));

Call to method mock from undeclared class \Phake
Open

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

Reference to constant PRE_SET_DATA from undeclared class \Symfony\Component\Form\FormEvents
Open

        $this->assertArrayHasKey(FormEvents::PRE_SET_DATA, $this->subscriber->getSubscribedEvents());

Call to method mock from undeclared class \Phake
Open

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

Reference to constant PRE_SUBMIT from undeclared class \Symfony\Component\Form\FormEvents
Open

        $this->assertArrayHasKey(FormEvents::PRE_SUBMIT, $this->subscriber->getSubscribedEvents());

Call to method verify from undeclared class \Phake
Open

        Phake::verify($this->optionsChild)->remove($this->optionChildName);

Call to method verify from undeclared class \Phake
Open

        Phake::verify($this->optionsChild)->remove($this->optionChildName);

Line exceeds 120 characters; contains 121 characters
Open

        Phake::verify($this->optionsChild)->add('max_length', 'text', array("search" => 'text', 'data' => $optionValue));

Line exceeds 120 characters; contains 121 characters
Open

        Phake::verify($this->optionsChild)->add('max_length', 'text', array("search" => 'text', 'data' => $optionValue));

Closing parenthesis of a multi-line function call must be on a line by itself
Open

            $this->fieldTypeClass);

Multi-line function call not indented correctly; expected 8 spaces but found 12
Open

            $this->fieldTypeClass);

There are no issues that match your filters.

Category
Status