open-orchestra/open-orchestra-cms-bundle

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

Summary

Maintainability
A
0 mins
Test Coverage

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

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

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

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

        $siteRepository = Phake::mock('OpenOrchestra\ModelInterface\Repository\SiteRepositoryInterface');

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->status = 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 'setUp'.
Open

        $this->event = Phake::mock('OpenOrchestra\ModelInterface\Event\StatusEvent');

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

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

Call to undeclared method \OpenOrchestra\Backoffice\Tests\EventSubscriber\UpdateEmbeddedStatusSubscriberTest::expectException
Open

        $this->expectException('\InvalidArgumentException');

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

        $this->assertArrayHasKey(StatusEvents::STATUS_UPDATE, $this->subscriber->getSubscribedEvents());

Call to method mock from undeclared class \Phake
Open

        $siteRepository = Phake::mock('OpenOrchestra\ModelInterface\Repository\SiteRepositoryInterface');

Call to method mock from undeclared class \Phake
Open

        $this->event = Phake::mock('OpenOrchestra\ModelInterface\Event\StatusEvent');

Call to method mock from undeclared class \Phake
Open

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

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

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

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

class UpdateEmbeddedStatusSubscriberTest extends AbstractBaseTestCase

Call to method mock from undeclared class \Phake
Open

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

Call to method verify from undeclared class \Phake
Open

        Phake::verify($this->statusableRepository2)->updateEmbeddedStatus($this->status);

Reference to constant STATUS_UPDATE from undeclared class \OpenOrchestra\ModelInterface\StatusEvents
Open

        $this->assertArrayHasKey(StatusEvents::STATUS_UPDATE, $this->subscriber->getSubscribedEvents());

Call to method verify from undeclared class \Phake
Open

        Phake::verify($this->statusableRepository1)->updateEmbeddedStatus($this->status);

Call to method when from undeclared class \Phake
Open

        Phake::when($this->event)->getStatus()->thenReturn($this->status);

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

    protected $statusableRepository1;

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 $statusableRepository2. Keep variable name length under 20.
Open

    protected $statusableRepository2;

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 133 characters
Open

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

Line exceeds 120 characters; contains 133 characters
Open

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

There are no issues that match your filters.

Category
Status