open-orchestra/open-orchestra-cms-bundle

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

Summary

Maintainability
A
1 hr
Test Coverage

Method generateOptions has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function generateOptions()
    {
        return array(
            array(null,
                array(
Severity: Minor
Found in Backoffice/Tests/EventSubscriber/ContentTypeTypeSubscriberTest.php - About 1 hr to fix

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

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

        $this->data = Phake::mock('OpenOrchestra\ModelInterface\Model\ContentTypeInterface');

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

        $child = 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 'setUp'.
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 'testOnPreSetData'.
Open

        Phake::verify($this->form, Phake::times($nbrCall))->add('contentTypeId', 'text', $expectedOptions);

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

Call to method when from undeclared class \Phake
Open

        Phake::when($this->formConfig)->getOptions()->thenReturn($options);

Call to method when from undeclared class \Phake
Open

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

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

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

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

class ContentTypeTypeSubscriberTest extends AbstractBaseTestCase

Call to method when from undeclared class \Phake
Open

        Phake::when($child)->getName()->thenReturn('contentTypeId');

Call to method verify from undeclared class \Phake
Open

        Phake::verify($this->form, Phake::times($nbrCall))->add('contentTypeId', 'text', $expectedOptions);

Call to method when from undeclared class \Phake
Open

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

Call to method when from undeclared class \Phake
Open

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

Call to method when from undeclared class \Phake
Open

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

Call to method mock from undeclared class \Phake
Open

        $this->data = Phake::mock('OpenOrchestra\ModelInterface\Model\ContentTypeInterface');

Call to method mock from undeclared class \Phake
Open

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

Call to method when from undeclared class \Phake
Open

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

Call to method times from undeclared class \Phake
Open

        Phake::verify($this->form, Phake::times($nbrCall))->add('contentTypeId', 'text', $expectedOptions);

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->data)->getContentTypeId()->thenReturn($contentTypeId);

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

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

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

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

Call to method mock from undeclared class \Phake
Open

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

Call to method mock from undeclared class \Phake
Open

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

Call to method mock from undeclared class \Phake
Open

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

Call to method when from undeclared class \Phake
Open

        Phake::when($this->form)->get('contentTypeId')->thenReturn($child);

Each PHP statement must be on a line by itself
Open

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

There are no issues that match your filters.

Category
Status