open-orchestra/open-orchestra-cms-bundle

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

Summary

Maintainability
A
0 mins
Test Coverage

The class UpdateReferenceSubscriberTest has a coupling between objects value of 18. Consider to reduce the number of dependencies under 13.
Open

class UpdateReferenceSubscriberTest extends AbstractBaseTestCase
{
    /**
     * @var UpdateReferenceSubscriber
     */

CouplingBetweenObjects

Since: 1.1.0

A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability

Example

class Foo {
    /**
     * @var \foo\bar\X
     */
    private $x = null;

    /**
     * @var \foo\bar\Y
     */
    private $y = null;

    /**
     * @var \foo\bar\Z
     */
    private $z = null;

    public function setFoo(\Foo $foo) {}
    public function setBar(\Bar $bar) {}
    public function setBaz(\Baz $baz) {}

    /**
     * @return \SplObjectStorage
     * @throws \OutOfRangeException
     * @throws \InvalidArgumentException
     * @throws \ErrorException
     */
    public function process(\Iterator $it) {}

    // ...
}

Source https://phpmd.org/rules/design.html#couplingbetweenobjects

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

        $contentType = Phake::mock(ContentTypeInterface::class);

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

        $contentTypeEvent = Phake::mock(ContentTypeEvent::class);

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

        $node = Phake::mock(NodeInterface::class);

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

        $nodeEvent = Phake::mock(NodeEvent::class);

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

        $blockEvent = Phake::mock(BlockEvent::class);

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

        $content = Phake::mock(ContentInterface::class);

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

        $blockEvent = Phake::mock(BlockEvent::class);

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->referenceManager = Phake::mock(ReferenceManager::class);

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

        $contentEvent = Phake::mock(ContentEvent::class);

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

        $deletedEntity = Phake::mock(SoftDeleteableInterface::class);

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

        $block = Phake::mock(ReadBlockInterface::class);

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

        $trashcanEvent = Phake::mock(TrashcanEvent::class);

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

        $block = Phake::mock(ReadBlockInterface::class);

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

Reference to constant CONTENT_UPDATE from undeclared class \OpenOrchestra\ModelInterface\ContentEvents
Open

        $this->assertArrayHasKey(ContentEvents::CONTENT_UPDATE, $this->subscriber->getSubscribedEvents());

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

        $this->assertArrayHasKey(BlockEvents::POST_BLOCK_CREATE, $this->subscriber->getSubscribedEvents());

Reference to constant CONTENT_CREATION from undeclared class \OpenOrchestra\ModelInterface\ContentEvents
Open

        $this->assertArrayHasKey(ContentEvents::CONTENT_CREATION, $this->subscriber->getSubscribedEvents());

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

        $this->assertArrayHasKey(ContentEvents::CONTENT_DUPLICATE, $this->subscriber->getSubscribedEvents());

Call to method mock from undeclared class \Phake
Open

        $this->referenceManager = Phake::mock(ReferenceManager::class);

Reference to constant NODE_CREATION from undeclared class \OpenOrchestra\ModelInterface\NodeEvents
Open

        $this->assertArrayHasKey(NodeEvents::NODE_CREATION, $this->subscriber->getSubscribedEvents());

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

        $this->assertArrayHasKey(NodeEvents::NODE_CREATION, $this->subscriber->getSubscribedEvents());

Call to method mock from undeclared class \Phake
Open

        $blockEvent = Phake::mock(BlockEvent::class);

Reference to constant class from undeclared class \OpenOrchestra\ModelInterface\Event\ContentTypeEvent
Open

        $contentTypeEvent = Phake::mock(ContentTypeEvent::class);

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

        $this->assertArrayHasKey(ContentEvents::CONTENT_CREATION, $this->subscriber->getSubscribedEvents());

Call to method mock from undeclared class \Phake
Open

        $deletedEntity = Phake::mock(SoftDeleteableInterface::class);

Reference to constant CONTENT_DUPLICATE from undeclared class \OpenOrchestra\ModelInterface\ContentEvents
Open

        $this->assertArrayHasKey(ContentEvents::CONTENT_DUPLICATE, $this->subscriber->getSubscribedEvents());

Reference to constant class from undeclared class \OpenOrchestra\ModelInterface\Event\TrashcanEvent
Open

        $trashcanEvent = Phake::mock(TrashcanEvent::class);

Reference to constant POST_BLOCK_CREATE from undeclared class \OpenOrchestra\ModelInterface\BlockEvents
Open

        $this->assertArrayHasKey(BlockEvents::POST_BLOCK_CREATE, $this->subscriber->getSubscribedEvents());

Call to method when from undeclared class \Phake
Open

        Phake::when($blockEvent)->getBlock()->thenReturn($block);

Reference to constant class from undeclared class \OpenOrchestra\ModelInterface\Model\ReadBlockInterface
Open

        $block = Phake::mock(ReadBlockInterface::class);

Call to method when from undeclared class \Phake
Open

        Phake::when($contentEvent)->getContent()->thenReturn($content);

Call to method mock from undeclared class \Phake
Open

        $nodeEvent = Phake::mock(NodeEvent::class);

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

class UpdateReferenceSubscriberTest extends AbstractBaseTestCase

Call to method mock from undeclared class \Phake
Open

        $block = Phake::mock(ReadBlockInterface::class);

Call to method mock from undeclared class \Phake
Open

        $content = Phake::mock(ContentInterface::class);

Call to method when from undeclared class \Phake
Open

        Phake::when($contentTypeEvent)->getContentType()->thenReturn($contentType);

Reference to constant CONTENT_TYPE_CREATE from undeclared class \OpenOrchestra\ModelInterface\ContentTypeEvents
Open

        $this->assertArrayHasKey(ContentTypeEvents::CONTENT_TYPE_CREATE, $this->subscriber->getSubscribedEvents());

Reference to constant class from undeclared class \OpenOrchestra\ModelInterface\Event\NodeEvent
Open

        $nodeEvent = Phake::mock(NodeEvent::class);

Call to method verify from undeclared class \Phake
Open

        Phake::verify($this->referenceManager)->updateReferencesToEntity($contentType);

Call to method mock from undeclared class \Phake
Open

        $trashcanEvent = Phake::mock(TrashcanEvent::class);

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

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

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

        $this->assertArrayHasKey(ContentEvents::CONTENT_UPDATE, $this->subscriber->getSubscribedEvents());

Reference to constant NODE_UPDATE from undeclared class \OpenOrchestra\ModelInterface\NodeEvents
Open

        $this->assertArrayHasKey(NodeEvents::NODE_UPDATE, $this->subscriber->getSubscribedEvents());

Reference to constant class from undeclared class \OpenOrchestra\ModelInterface\Event\BlockEvent
Open

        $blockEvent = Phake::mock(BlockEvent::class);

Reference to constant class from undeclared class \OpenOrchestra\ModelInterface\Model\ContentInterface
Open

        $content = Phake::mock(ContentInterface::class);

Call to method verify from undeclared class \Phake
Open

        Phake::verify($this->referenceManager)->updateReferencesToEntity($content);

Reference to constant class from undeclared class \OpenOrchestra\ModelInterface\Event\BlockEvent
Open

        $blockEvent = Phake::mock(BlockEvent::class);

Call to method verify from undeclared class \Phake
Open

        Phake::verify($this->referenceManager)->removeReferencesToEntity($deletedEntity);

Call to method mock from undeclared class \Phake
Open

        $block = Phake::mock(ReadBlockInterface::class);

Call to method mock from undeclared class \Phake
Open

        $contentType = Phake::mock(ContentTypeInterface::class);

Call to method when from undeclared class \Phake
Open

        Phake::when($trashcanEvent)->getDeletedEntity()->thenReturn($deletedEntity);

Reference to constant CONTENT_TYPE_UPDATE from undeclared class \OpenOrchestra\ModelInterface\ContentTypeEvents
Open

        $this->assertArrayHasKey(ContentTypeEvents::CONTENT_TYPE_UPDATE, $this->subscriber->getSubscribedEvents());

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

        $this->assertArrayHasKey(ContentTypeEvents::CONTENT_TYPE_UPDATE, $this->subscriber->getSubscribedEvents());

Reference to constant class from undeclared class \OpenOrchestra\ModelInterface\Event\ContentEvent
Open

        $contentEvent = Phake::mock(ContentEvent::class);

Reference to constant class from undeclared class \OpenOrchestra\ModelInterface\Model\ContentTypeInterface
Open

        $contentType = Phake::mock(ContentTypeInterface::class);

Reference to constant POST_BLOCK_UPDATE from undeclared class \OpenOrchestra\ModelInterface\BlockEvents
Open

        $this->assertArrayHasKey(BlockEvents::POST_BLOCK_UPDATE, $this->subscriber->getSubscribedEvents());

Reference to constant POST_BLOCK_DELETE from undeclared class \OpenOrchestra\ModelInterface\BlockEvents
Open

        $this->assertArrayHasKey(BlockEvents::POST_BLOCK_DELETE, $this->subscriber->getSubscribedEvents());

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

        $this->assertArrayHasKey(BlockEvents::POST_BLOCK_DELETE, $this->subscriber->getSubscribedEvents());

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

        $this->assertArrayHasKey(NodeEvents::NODE_UPDATE, $this->subscriber->getSubscribedEvents());

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

        $this->assertArrayHasKey(TrashcanEvents::TRASHCAN_REMOVE_ENTITY, $this->subscriber->getSubscribedEvents());

Call to method when from undeclared class \Phake
Open

        Phake::when($blockEvent)->getBlock()->thenReturn($block);

Call to method verify from undeclared class \Phake
Open

        Phake::verify($this->referenceManager)->updateReferencesToEntity($block);

Call to method mock from undeclared class \Phake
Open

        $contentEvent = Phake::mock(ContentEvent::class);

Call to method mock from undeclared class \Phake
Open

        $node = Phake::mock(NodeInterface::class);

Call to method verify from undeclared class \Phake
Open

        Phake::verify($this->referenceManager)->updateReferencesToEntity($node);

Reference to constant class from undeclared class \OpenOrchestra\ModelInterface\Model\ReadBlockInterface
Open

        $block = Phake::mock(ReadBlockInterface::class);

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

        $this->assertArrayHasKey(BlockEvents::POST_BLOCK_UPDATE, $this->subscriber->getSubscribedEvents());

Reference to constant class from undeclared class \OpenOrchestra\ModelInterface\Model\NodeInterface
Open

        $node = Phake::mock(NodeInterface::class);

Call to method when from undeclared class \Phake
Open

        Phake::when($nodeEvent)->getNode()->thenReturn($node);

Call to method mock from undeclared class \Phake
Open

        $blockEvent = Phake::mock(BlockEvent::class);

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

        $this->assertArrayHasKey(ContentTypeEvents::CONTENT_TYPE_CREATE, $this->subscriber->getSubscribedEvents());

Reference to constant TRASHCAN_REMOVE_ENTITY from undeclared class \OpenOrchestra\ModelInterface\TrashcanEvents
Open

        $this->assertArrayHasKey(TrashcanEvents::TRASHCAN_REMOVE_ENTITY, $this->subscriber->getSubscribedEvents());

Reference to constant class from undeclared class \OpenOrchestra\ModelInterface\Model\SoftDeleteableInterface
Open

        $deletedEntity = Phake::mock(SoftDeleteableInterface::class);

Call to method mock from undeclared class \Phake
Open

        $contentTypeEvent = Phake::mock(ContentTypeEvent::class);

Call to method verify from undeclared class \Phake
Open

        Phake::verify($this->referenceManager)->removeReferencesToEntity($block);

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

    }

There are no issues that match your filters.

Category
Status