open-orchestra/open-orchestra-cms-bundle

View on GitHub
WorkflowAdminBundle/Tests/EventSubscriber/AddGroupWorkflowProfileSubscriberTest.php

Summary

Maintainability
A
1 hr
Test Coverage

Method testAddWorkflowProfile has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function testAddWorkflowProfile()
    {
        $event = Phake::mock('OpenOrchestra\GroupBundle\Event\GroupFormEvent');
        $builder = Phake::mock('Symfony\Component\Form\FormBuilderInterface');
        $group = Phake::mock('OpenOrchestra\Backoffice\Model\GroupInterface');

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

        $workflowProfileRepository = Phake::mock('OpenOrchestra\ModelBundle\Repository\WorkflowProfileRepository');

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

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

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

        Phake::verify($builder, Phake::times(1))->add('workflow_profile_collections', 'oo_check_list_collection', array(

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->contenType)->getName(Phake::anyParameters())->thenReturn('fakeName');

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

        $event = Phake::mock('OpenOrchestra\GroupBundle\Event\GroupFormEvent');

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

        $contentTypeRepository = Phake::mock('OpenOrchestra\ModelInterface\Repository\ContentTypeRepositoryInterface');

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($contentTypeRepository)->findAllNotDeletedInLastVersion(Phake::anyParameters())->thenReturn(array($this->contenType));

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

        Phake::verify($builder, Phake::times(2))->setAttribute(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 'testAddWorkflowProfile'.
Open

        $group = Phake::mock('OpenOrchestra\Backoffice\Model\GroupInterface');

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

        Phake::when($builder)->get(Phake::anyParameters())->thenReturn($builder);

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

        $site = Phake::mock('OpenOrchestra\ModelInterface\Model\SiteInterface');

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

        Phake::when($builder)->getAttribute(Phake::anyParameters())->thenReturn(array());

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

        $workflowProfile = Phake::mock('OpenOrchestra\ModelInterface\Model\WorkflowProfileInterface');

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($translator)->trans(Phake::anyParameters())->thenReturn('fakeTrans');

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

        Phake::verify($builder, Phake::times(1))->addModelTransformer(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 'testAddWorkflowProfile'.
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 'testAddWorkflowProfile'.
Open

        Phake::verify($builder, Phake::times(2))->setAttribute(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 'setUp'.
Open

        Phake::when($workflowProfile)->getLabel(\Phake::anyParameters())->thenReturn('fakeWorkflowProfileLabel');

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->contenType = 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 'testAddWorkflowProfile'.
Open

        Phake::when($builder)->getAttribute(Phake::anyParameters())->thenReturn(array());

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

        Phake::verify($builder, Phake::times(1))->addModelTransformer(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 'setUp'.
Open

        $contextManager = Phake::mock('OpenOrchestra\Backoffice\Context\ContextBackOfficeInterface');

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

        $translator = Phake::mock('Symfony\Component\Translation\TranslatorInterface');

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

        $contentTypeRepository = Phake::mock('OpenOrchestra\ModelInterface\Repository\ContentTypeRepositoryInterface');

Call to method when from undeclared class \Phake
Open

        Phake::when($contentTypeRepository)->findAllNotDeletedInLastVersion(Phake::anyParameters())->thenReturn(array($this->contenType));

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

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

Call to method mock from undeclared class \Phake
Open

        $event = Phake::mock('OpenOrchestra\GroupBundle\Event\GroupFormEvent');

Call to method when from undeclared class \Phake
Open

        Phake::when($builder)->getAttribute(Phake::anyParameters())->thenReturn(array());

Call to method when from undeclared class \Phake
Open

        Phake::when($workflowProfileRepository)->findAll()->thenReturn(array($workflowProfile));

Call to method when from undeclared class \Phake
Open

        Phake::when($this->contenType)->getName(Phake::anyParameters())->thenReturn('fakeName');

Call to method mock from undeclared class \Phake
Open

        $translator = Phake::mock('Symfony\Component\Translation\TranslatorInterface');

Call to method when from undeclared class \Phake
Open

        Phake::when($builder)->getData()->thenReturn($group);

Call to method times from undeclared class \Phake
Open

        Phake::verify($builder, Phake::times(1))->addModelTransformer(Phake::anyParameters());

Call to method mock from undeclared class \Phake
Open

        $workflowProfileRepository = Phake::mock('OpenOrchestra\ModelBundle\Repository\WorkflowProfileRepository');

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

        $this->assertArrayHasKey(GroupFormEvents::GROUP_FORM_CREATION, $this->subscriber->getSubscribedEvents());

Call to method anyParameters from undeclared class \Phake
Open

        Phake::when($workflowProfile)->getLabel(\Phake::anyParameters())->thenReturn('fakeWorkflowProfileLabel');

Call to method mock from undeclared class \Phake
Open

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

Call to method anyParameters from undeclared class \Phake
Open

        Phake::when($contentTypeRepository)->findAllNotDeletedInLastVersion(Phake::anyParameters())->thenReturn(array($this->contenType));

Call to method anyParameters from undeclared class \Phake
Open

        Phake::when($this->contenType)->getName(Phake::anyParameters())->thenReturn('fakeName');

Call to method mock from undeclared class \Phake
Open

        $site = Phake::mock('OpenOrchestra\ModelInterface\Model\SiteInterface');

Call to method times from undeclared class \Phake
Open

        Phake::verify($builder, Phake::times(1))->add('workflow_profile_collections', 'oo_check_list_collection', array(

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

class AddGroupWorkflowProfileSubscriberTest extends AbstractBaseTestCase

Call to method anyParameters from undeclared class \Phake
Open

        Phake::when($translator)->trans(Phake::anyParameters())->thenReturn('fakeTrans');

Call to method when from undeclared class \Phake
Open

        Phake::when($builder)->getAttribute(Phake::anyParameters())->thenReturn(array());

Call to method verify from undeclared class \Phake
Open

        Phake::verify($builder, Phake::times(1))->add('workflow_profile_collections', 'oo_check_list_collection', array(

Call to method mock from undeclared class \Phake
Open

        $workflowProfile = Phake::mock('OpenOrchestra\ModelInterface\Model\WorkflowProfileInterface');

Call to method when from undeclared class \Phake
Open

        Phake::when($workflowProfile)->getLabel(\Phake::anyParameters())->thenReturn('fakeWorkflowProfileLabel');

Call to method when from undeclared class \Phake
Open

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

Call to method anyParameters from undeclared class \Phake
Open

        Phake::when($builder)->getAttribute(Phake::anyParameters())->thenReturn(array());

Call to method when from undeclared class \Phake
Open

        Phake::when($event)->getBuilder()->thenReturn($builder);

Call to method anyParameters from undeclared class \Phake
Open

        Phake::verify($builder, Phake::times(2))->setAttribute(Phake::anyParameters());

Call to method verify from undeclared class \Phake
Open

        Phake::verify($builder, Phake::times(2))->setAttribute(Phake::anyParameters());

Call to method mock from undeclared class \Phake
Open

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

Call to method when from undeclared class \Phake
Open

        Phake::when($builder)->get(Phake::anyParameters())->thenReturn($builder);

Call to method anyParameters from undeclared class \Phake
Open

        Phake::when($builder)->getAttribute(Phake::anyParameters())->thenReturn(array());

Call to method times from undeclared class \Phake
Open

        Phake::verify($builder, Phake::times(2))->setAttribute(Phake::anyParameters());

Call to method when from undeclared class \Phake
Open

        Phake::when($translator)->trans(Phake::anyParameters())->thenReturn('fakeTrans');

Call to method when from undeclared class \Phake
Open

        Phake::when($group)->getSite()->thenReturn($site);

Call to method anyParameters from undeclared class \Phake
Open

        Phake::verify($builder, Phake::times(1))->addModelTransformer(Phake::anyParameters());

Call to method mock from undeclared class \Phake
Open

        $contextManager = Phake::mock('OpenOrchestra\Backoffice\Context\ContextBackOfficeInterface');

Call to method mock from undeclared class \Phake
Open

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

Call to method mock from undeclared class \Phake
Open

        $group = Phake::mock('OpenOrchestra\Backoffice\Model\GroupInterface');

Call to method when from undeclared class \Phake
Open

        Phake::when($site)->getContentTypes()->thenReturn(array($this->contenType));

Call to method anyParameters from undeclared class \Phake
Open

        Phake::when($builder)->get(Phake::anyParameters())->thenReturn($builder);

Call to method verify from undeclared class \Phake
Open

        Phake::verify($builder, Phake::times(1))->addModelTransformer(Phake::anyParameters());

Avoid excessively long variable names like $workflowProfileRepository. Keep variable name length under 20.
Open

        $workflowProfileRepository = Phake::mock('OpenOrchestra\ModelBundle\Repository\WorkflowProfileRepository');

LongVariable

Since: 0.2

Detects when a field, formal or local variable is declared with a long name.

Example

class Something {
    protected $reallyLongIntName = -3; // VIOLATION - Field
    public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

Source https://phpmd.org/rules/naming.html#longvariable

Avoid excessively long variable names like $workflowProfileCollectionTransformer. Keep variable name length under 20.
Open

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

LongVariable

Since: 0.2

Detects when a field, formal or local variable is declared with a long name.

Example

class Something {
    protected $reallyLongIntName = -3; // VIOLATION - Field
    public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

Source https://phpmd.org/rules/naming.html#longvariable

Avoid excessively long variable names like $contentTypeRepository. Keep variable name length under 20.
Open

        $contentTypeRepository = Phake::mock('OpenOrchestra\ModelInterface\Repository\ContentTypeRepositoryInterface');

LongVariable

Since: 0.2

Detects when a field, formal or local variable is declared with a long name.

Example

class Something {
    protected $reallyLongIntName = -3; // VIOLATION - Field
    public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

Source https://phpmd.org/rules/naming.html#longvariable

Line exceeds 120 characters; contains 138 characters
Open

        Phake::when($contentTypeRepository)->findAllNotDeletedInLastVersion(Phake::anyParameters())->thenReturn(array($this->contenType));

There are no issues that match your filters.

Category
Status