open-orchestra/open-orchestra-cms-bundle

View on GitHub
Backoffice/Tests/Reference/Strategies/AbstractReferenceStrategyTest.php

Summary

Maintainability
A
1 hr
Test Coverage

Method checkRemoveReferencesToEntity has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    protected function checkRemoveReferencesToEntity($entity, $entityId, array $usedItems, $entityType, $itemRepository)
Severity: Minor
Found in Backoffice/Tests/Reference/Strategies/AbstractReferenceStrategyTest.php - About 35 mins to fix

Method checkAddReferencesToEntity has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    protected function checkAddReferencesToEntity($entity, $entityId, array $usedItems, $entityType, $itemRepository)
Severity: Minor
Found in Backoffice/Tests/Reference/Strategies/AbstractReferenceStrategyTest.php - About 35 mins to fix

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

        Phake::when($itemRepository)->findByUsedInEntity(Phake::anyParameters())->thenReturn($usedItems);

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

        $node = Phake::mock('OpenOrchestra\ModelInterface\Model\NodeInterface');

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

        $attribute = Phake::mock('OpenOrchestra\ModelInterface\Model\ContentAttributeInterface');

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

        $keyword = Phake::mock('OpenOrchestra\ModelInterface\Model\KeywordInterface');

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

        $contentType = 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 'createPhakeContent'.
Open

        $content = Phake::mock('OpenOrchestra\ModelInterface\Model\ContentInterface');

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

        $block = Phake::mock('OpenOrchestra\ModelInterface\Model\BlockInterface');

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

        Phake::when($itemRepository)->findByUsedInEntity(Phake::anyParameters())->thenReturn($usedItems);

Call to method __construct from undeclared class \Doctrine\Common\Collections\ArrayCollection
Open

        Phake::when($content)->getAttributes()->thenReturn(new ArrayCollection($attributes));

Return type of createPhakeNode() is undeclared type \OpenOrchestra\Backoffice\Tests\Reference\Strategies\Phake_IMock
Open

    protected function createPhakeNode($nodeId = 'nodeId')

Call to method mock from undeclared class \Phake
Open

        $content = Phake::mock('OpenOrchestra\ModelInterface\Model\ContentInterface');

Call to method when from undeclared class \Phake
Open

        Phake::when($itemRepository)->findByUsedInEntity(Phake::anyParameters())->thenReturn($usedItems);

Call to undeclared method \OpenOrchestra\Backoffice\Tests\Reference\Strategies\AbstractReferenceStrategyTest::assertSame
Open

        $this->assertSame($isSupported, $support);

Return type of createPhakeContent() is undeclared type \OpenOrchestra\Backoffice\Tests\Reference\Strategies\Phake_IMock
Open

    protected function createPhakeContent($contentId = 'contentId', array $attributes = array())

Call to method when from undeclared class \Phake
Open

        Phake::when($content)->getId()->thenReturn($contentId);

Call to method mock from undeclared class \Phake
Open

        $node = Phake::mock('OpenOrchestra\ModelInterface\Model\NodeInterface');

Call to method when from undeclared class \Phake
Open

            Phake::when($itemRepository)->find($itemId)->thenReturn($item);

Call to method when from undeclared class \Phake
Open

        Phake::when($content)->getAttributes()->thenReturn(new ArrayCollection($attributes));

Call to method verify from undeclared class \Phake
Open

            Phake::verify($item)->addUseInEntity($entityId, $entityType);

Call to method verify from undeclared class \Phake
Open

            Phake::verify($item)->removeUseInEntity($entityId, $entityType);

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

abstract class AbstractReferenceStrategyTest extends AbstractBaseTestCase

Return type of createPhakeContentAttribute() is undeclared type \OpenOrchestra\Backoffice\Tests\Reference\Strategies\Phake_IMock
Open

    protected function createPhakeContentAttribute($value = '', $type = '')

Call to method mock from undeclared class \Phake
Open

        $attribute = Phake::mock('OpenOrchestra\ModelInterface\Model\ContentAttributeInterface');

Call to method when from undeclared class \Phake
Open

        Phake::when($node)->getId()->thenReturn($nodeId);

Return type of createPhakeBlock() is undeclared type \OpenOrchestra\Backoffice\Tests\Reference\Strategies\Phake_IMock
Open

    protected function createPhakeBlock($blockId = 'blockId')

Call to method mock from undeclared class \Phake
Open

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

Call to method when from undeclared class \Phake
Open

        Phake::when($contentType)->getContentTypeId()->thenReturn($contentTypeId);

Return type of createPhakeContentType() is undeclared type \OpenOrchestra\Backoffice\Tests\Reference\Strategies\Phake_IMock
Open

    protected function createPhakeContentType($contentTypeId = 'contentTypeId')

Call to method when from undeclared class \Phake
Open

        Phake::when($attribute)->getType()->thenReturn($type);

Call to method when from undeclared class \Phake
Open

        Phake::when($attribute)->getValue()->thenReturn($value);

Call to method when from undeclared class \Phake
Open

        Phake::when($block)->getId()->thenReturn($blockId);

Return type of createPhakeKeyword() is undeclared type \OpenOrchestra\Backoffice\Tests\Reference\Strategies\Phake_IMock
Open

    protected function createPhakeKeyword($keywordId = 'keywordId')

Call to method mock from undeclared class \Phake
Open

        $block = Phake::mock('OpenOrchestra\ModelInterface\Model\BlockInterface');

Call to method when from undeclared class \Phake
Open

        Phake::when($keyword)->getId()->thenReturn($keywordId);

Call to method mock from undeclared class \Phake
Open

        $keyword = Phake::mock('OpenOrchestra\ModelInterface\Model\KeywordInterface');

Visibility must be declared on method "testAddReferencesToEntity"
Open

    abstract function testAddReferencesToEntity($entity, $entityId, array $usedItems);

Visibility must be declared on method "testRemoveReferencesToEntity"
Open

    abstract function testRemoveReferencesToEntity($entity, $entityId, array $usedItems);

There are no issues that match your filters.

Category
Status