open-orchestra/open-orchestra-cms-bundle

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

Summary

Maintainability
A
1 hr
Test Coverage

Method provideEvent has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function provideEvent()
    {
        $event0 = Phake::mock('Symfony\Component\Form\FormEvent');
        $form0 = Phake::mock('Symfony\Component\Form\FormInterface');
        $contentType0 = Phake::mock('OpenOrchestra\ModelInterface\Model\ContentTypeInterface');

Missing class import via use statement (line '99', column '56').
Open

        Phake::when($form2)->getData()->thenReturn(new \stdClass());

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

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

        Phake::verify($this->statusRepository, Phake::times($isInitial))->findOneByInitial();

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($this->statusRepository)->findOneByOutOfWorkflow()->thenReturn(Phake::mock('OpenOrchestra\ModelInterface\Model\StatusInterface'));

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

        $form0 = 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 'provideEvent'.
Open

        $event2 = 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 'provideEvent'.
Open

        $contentType0 = 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 'provideEvent'.
Open

        $event1 = 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->contentRepository = Phake::mock('OpenOrchestra\ModelInterface\Repository\ContentRepositoryInterface');

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->statusRepository = Phake::mock('OpenOrchestra\ModelInterface\Repository\StatusRepositoryInterface');

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($this->statusRepository)->findOneByInitial()->thenReturn(Phake::mock('OpenOrchestra\ModelInterface\Model\StatusInterface'));

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

        Phake::verify($this->contentRepository, Phake::times($isUpdated))->updateStatusByContentType(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 'provideEvent'.
Open

        $event0 = 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 'provideEvent'.
Open

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

        Phake::verify($this->contentRepository, Phake::times($isUpdated))->updateStatusByContentType(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 'provideEvent'.
Open

        $form1 = 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 'provideEvent'.
Open

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

        Phake::verify($this->statusRepository, Phake::times($isOutOfWorkflow))->findOneByOutOfWorkflow();

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

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

Call to method when from undeclared class \Phake
Open

        Phake::when($event2)->getData()->thenReturn(array());

Call to method mock from undeclared class \Phake
Open

        $this->statusRepository = Phake::mock('OpenOrchestra\ModelInterface\Repository\StatusRepositoryInterface');

Call to method when from undeclared class \Phake
Open

        Phake::when($this->statusRepository)->findOneByInitial()->thenReturn(Phake::mock('OpenOrchestra\ModelInterface\Model\StatusInterface'));

Call to method times from undeclared class \Phake
Open

        Phake::verify($this->contentRepository, Phake::times($isUpdated))->updateStatusByContentType(Phake::anyParameters());

Call to method when from undeclared class \Phake
Open

        Phake::when($event1)->getForm()->thenReturn($form1);

Call to method when from undeclared class \Phake
Open

        Phake::when($event1)->getData()->thenReturn(array('definingStatusable' => 0));

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

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

Call to method when from undeclared class \Phake
Open

        Phake::when($event2)->getForm()->thenReturn($form2);

Call to method mock from undeclared class \Phake
Open

        $this->contentRepository = Phake::mock('OpenOrchestra\ModelInterface\Repository\ContentRepositoryInterface');

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

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

Call to method anyParameters from undeclared class \Phake
Open

        Phake::verify($this->contentRepository, Phake::times($isUpdated))->updateStatusByContentType(Phake::anyParameters());

Call to method when from undeclared class \Phake
Open

        Phake::when($event0)->getForm()->thenReturn($form0);

Call to method mock from undeclared class \Phake
Open

        $contentType1 = Phake::mock('OpenOrchestra\ModelInterface\Model\ContentTypeInterface');

Call to method verify from undeclared class \Phake
Open

        Phake::verify($this->contentRepository, Phake::times($isUpdated))->updateStatusByContentType(Phake::anyParameters());

Call to method mock from undeclared class \Phake
Open

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

Call to method mock from undeclared class \Phake
Open

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

Call to method when from undeclared class \Phake
Open

        Phake::when($event0)->getData()->thenReturn(array('definingStatusable' => 1));

Call to method mock from undeclared class \Phake
Open

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

Call to method when from undeclared class \Phake
Open

        Phake::when($this->statusRepository)->findOneByOutOfWorkflow()->thenReturn(Phake::mock('OpenOrchestra\ModelInterface\Model\StatusInterface'));

Call to method when from undeclared class \Phake
Open

        Phake::when($form0)->getData()->thenReturn($contentType0);

Call to method when from undeclared class \Phake
Open

        Phake::when($form2)->getData()->thenReturn(new \stdClass());

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

class ContentTypeStatusableSubscriberTest extends AbstractBaseTestCase

Call to method mock from undeclared class \Phake
Open

        Phake::when($this->statusRepository)->findOneByInitial()->thenReturn(Phake::mock('OpenOrchestra\ModelInterface\Model\StatusInterface'));

Call to method mock from undeclared class \Phake
Open

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

Saw an @param annotation for isUdpated, but it was not found in the param list of function testPreSubmit(\Symfony\Component\Form\FormEvent $event, int $isInitial, int $isOutOfWorkflow, $isUpdated)
Open

     * @param int       $isUdpated

Parameter $event has undeclared type \Symfony\Component\Form\FormEvent
Open

    public function testPreSubmit(FormEvent $event, $isInitial, $isOutOfWorkflow, $isUpdated)

Call to method times from undeclared class \Phake
Open

        Phake::verify($this->statusRepository, Phake::times($isOutOfWorkflow))->findOneByOutOfWorkflow();

Call to method when from undeclared class \Phake
Open

        Phake::when($contentType0)->isDefiningStatusable()->thenReturn(false);

Call to method times from undeclared class \Phake
Open

        Phake::verify($this->statusRepository, Phake::times($isInitial))->findOneByInitial();

Call to method mock from undeclared class \Phake
Open

        $contentType0 = Phake::mock('OpenOrchestra\ModelInterface\Model\ContentTypeInterface');

Call to method when from undeclared class \Phake
Open

        Phake::when($contentType0)->getContentTypeId()->thenReturn('fakeContentTypeId');

Call to method when from undeclared class \Phake
Open

        Phake::when($contentType1)->isDefiningStatusable()->thenReturn(true);

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->statusRepository, Phake::times($isInitial))->findOneByInitial();

Call to method when from undeclared class \Phake
Open

        Phake::when($form1)->getData()->thenReturn($contentType1);

Call to method verify from undeclared class \Phake
Open

        Phake::verify($this->statusRepository, Phake::times($isOutOfWorkflow))->findOneByOutOfWorkflow();

Call to method mock from undeclared class \Phake
Open

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

Call to method mock from undeclared class \Phake
Open

        Phake::when($this->statusRepository)->findOneByOutOfWorkflow()->thenReturn(Phake::mock('OpenOrchestra\ModelInterface\Model\StatusInterface'));

Call to method when from undeclared class \Phake
Open

        Phake::when($contentType1)->getContentTypeId()->thenReturn('fakeContentTypeId');

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

    }

Line exceeds 120 characters; contains 144 characters
Open

        Phake::when($this->statusRepository)->findOneByInitial()->thenReturn(Phake::mock('OpenOrchestra\ModelInterface\Model\StatusInterface'));

Line exceeds 120 characters; contains 125 characters
Open

        Phake::verify($this->contentRepository, Phake::times($isUpdated))->updateStatusByContentType(Phake::anyParameters());

Line exceeds 120 characters; contains 150 characters
Open

        Phake::when($this->statusRepository)->findOneByOutOfWorkflow()->thenReturn(Phake::mock('OpenOrchestra\ModelInterface\Model\StatusInterface'));

There are no issues that match your filters.

Category
Status