open-orchestra/open-orchestra-cms-bundle

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

Summary

Maintainability
A
0 mins
Test Coverage

Avoid using static access to class '\Phake' in method 'setUp'.
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 'setUp'.
Open

        $siteAlias1 = Phake::mock('OpenOrchestra\ModelInterface\Model\SiteAliasInterface');

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\SiteEvent');

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

        Phake::verify($this->objectManager, Phake::times(1))->persist(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

        $this->objectManager = Phake::mock('Doctrine\Common\Persistence\ObjectManager');

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

        Phake::verify($this->objectManager, Phake::times(1))->flush(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($this->nodeRepository)->findLastVersionByType(Phake::anyParameters())->thenReturn(array($node, $node));

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

        Phake::verify($this->site, Phake::times(2))->addAlias(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 'testUpdateSiteAliasesIndexOnSiteCreate'.
Open

        Phake::verify($this->objectManager, Phake::times(1))->flush(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 'testDeleteRedirectionOnSiteDelete'.
Open

        Phake::verify($this->redirectionManager, Phake::times(2))->deleteRedirection(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 'testUpdateRedirectionOnSiteUpdate'.
Open

        Phake::verify($this->redirectionManager, Phake::times(2))->generateRedirectionForNode(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 'testUpdateSiteAliasesIndexOnSiteCreate'.
Open

        Phake::verify($this->site, Phake::times(2))->removeAlias(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

        $siteAlias0 = Phake::mock('OpenOrchestra\ModelInterface\Model\SiteAliasInterface');

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

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

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

        Phake::verify($this->redirectionManager, Phake::times(2))->deleteRedirection(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 'testUpdateSiteAliasesIndexOnSiteCreate'.
Open

        Phake::verify($this->objectManager, Phake::times(1))->persist(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

        $this->redirectionManager = Phake::mock('OpenOrchestra\Backoffice\Manager\RedirectionManager');

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

        Phake::verify($this->site, Phake::times(2))->addAlias(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 'testUpdateRedirectionOnSiteUpdate'.
Open

        Phake::verify($this->redirectionManager, Phake::times(2))->generateRedirectionForNode(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 'testUpdateSiteAliasesIndexOnSiteCreate'.
Open

        Phake::verify($this->site, Phake::times(2))->removeAlias(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

Call to method mock from undeclared class \Phake
Open

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

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

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

Reference to constant SITE_CREATE from undeclared class \OpenOrchestra\ModelInterface\SiteEvents
Open

        $this->assertArrayHasKey(SiteEvents::SITE_CREATE, $this->subscriber->getSubscribedEvents());

Call to method verify from undeclared class \Phake
Open

        Phake::verify($this->site, Phake::times(2))->removeAlias(Phake::anyParameters());

Reference to undeclared property \OpenOrchestra\Backoffice\Tests\EventSubscriber\UpdateSiteAliasRedirectionSiteSubscriberTest->redirectionManager
Open

        Phake::verify($this->redirectionManager, Phake::times(2))->generateRedirectionForNode(Phake::anyParameters());

Call to method anyParameters from undeclared class \Phake
Open

        Phake::when($this->nodeRepository)->findLastVersionByType(Phake::anyParameters())->thenReturn(array($node, $node));

Call to method verify from undeclared class \Phake
Open

        Phake::verify($this->redirectionManager, Phake::times(2))->generateRedirectionForNode(Phake::anyParameters());

Call to method mock from undeclared class \Phake
Open

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

Call to method mock from undeclared class \Phake
Open

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

Call to method times from undeclared class \Phake
Open

        Phake::verify($this->objectManager, Phake::times(1))->persist(Phake::anyParameters());

Call to method verify from undeclared class \Phake
Open

        Phake::verify($this->redirectionManager, Phake::times(2))->deleteRedirection(Phake::anyParameters());

Call to method anyParameters from undeclared class \Phake
Open

        Phake::verify($this->site, Phake::times(2))->addAlias(Phake::anyParameters());

Call to method times from undeclared class \Phake
Open

        Phake::verify($this->redirectionManager, Phake::times(2))->deleteRedirection(Phake::anyParameters());

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

class UpdateSiteAliasRedirectionSiteSubscriberTest extends AbstractBaseTestCase

Reference to undeclared property \OpenOrchestra\Backoffice\Tests\EventSubscriber\UpdateSiteAliasRedirectionSiteSubscriberTest->redirectionManager
Open

        $this->redirectionManager = Phake::mock('OpenOrchestra\Backoffice\Manager\RedirectionManager');

Call to method when from undeclared class \Phake
Open

        Phake::when($this->nodeRepository)->findLastVersionByType(Phake::anyParameters())->thenReturn(array($node, $node));

Call to method times from undeclared class \Phake
Open

        Phake::verify($this->redirectionManager, Phake::times(2))->generateRedirectionForNode(Phake::anyParameters());

Call to method when from undeclared class \Phake
Open

        Phake::when($this->site)->getAliases()->thenReturn(new ArrayCollection(array($siteAlias0, $siteAlias1)));

Call to method times from undeclared class \Phake
Open

        Phake::verify($this->site, Phake::times(2))->addAlias(Phake::anyParameters());

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

        Phake::when($this->event)->getOldAliases()->thenReturn(new ArrayCollection());

Call to method when from undeclared class \Phake
Open

        Phake::when($this->event)->getOldAliases()->thenReturn(new ArrayCollection());

Reference to constant SITE_UPDATE from undeclared class \OpenOrchestra\ModelInterface\SiteEvents
Open

        $this->assertArrayHasKey(SiteEvents::SITE_UPDATE, $this->subscriber->getSubscribedEvents());

Call to method times from undeclared class \Phake
Open

        Phake::verify($this->objectManager, Phake::times(1))->flush(Phake::anyParameters());

Call to method mock from undeclared class \Phake
Open

        $siteAlias1 = Phake::mock('OpenOrchestra\ModelInterface\Model\SiteAliasInterface');

Reference to constant SITE_DELETE from undeclared class \OpenOrchestra\ModelInterface\SiteEvents
Open

        $this->assertArrayHasKey(SiteEvents::SITE_DELETE, $this->subscriber->getSubscribedEvents());

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

        $this->assertArrayHasKey(SiteEvents::SITE_DELETE, $this->subscriber->getSubscribedEvents());

Call to method times from undeclared class \Phake
Open

        Phake::verify($this->site, Phake::times(2))->removeAlias(Phake::anyParameters());

Call to method mock from undeclared class \Phake
Open

        $this->objectManager = Phake::mock('Doctrine\Common\Persistence\ObjectManager');

Call to method verify from undeclared class \Phake
Open

        Phake::verify($this->objectManager, Phake::times(1))->persist(Phake::anyParameters());

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

        $this->assertArrayHasKey(SiteEvents::SITE_UPDATE, $this->subscriber->getSubscribedEvents());

Call to method anyParameters from undeclared class \Phake
Open

        Phake::verify($this->objectManager, Phake::times(1))->persist(Phake::anyParameters());

Call to method verify from undeclared class \Phake
Open

        Phake::verify($this->objectManager, Phake::times(1))->flush(Phake::anyParameters());

Call to method mock from undeclared class \Phake
Open

        $this->redirectionManager = Phake::mock('OpenOrchestra\Backoffice\Manager\RedirectionManager');

Reference to undeclared property \OpenOrchestra\Backoffice\Tests\EventSubscriber\UpdateSiteAliasRedirectionSiteSubscriberTest->redirectionManager
Open

        Phake::verify($this->redirectionManager, Phake::times(2))->deleteRedirection(Phake::anyParameters());

Reference to undeclared property \OpenOrchestra\Backoffice\Tests\EventSubscriber\UpdateSiteAliasRedirectionSiteSubscriberTest->redirectionManager
Open

        $this->subscriber = new UpdateSiteAliasRedirectionSiteSubscriber($this->objectManager, $this->redirectionManager, $this->nodeRepository);

Call to method mock from undeclared class \Phake
Open

        $siteAlias0 = Phake::mock('OpenOrchestra\ModelInterface\Model\SiteAliasInterface');

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

        Phake::when($this->site)->getAliases()->thenReturn(new ArrayCollection(array($siteAlias0, $siteAlias1)));

Call to method mock from undeclared class \Phake
Open

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

Call to method verify from undeclared class \Phake
Open

        Phake::verify($this->site, Phake::times(2))->addAlias(Phake::anyParameters());

Call to method anyParameters from undeclared class \Phake
Open

        Phake::verify($this->objectManager, Phake::times(1))->flush(Phake::anyParameters());

Call to method anyParameters from undeclared class \Phake
Open

        Phake::verify($this->redirectionManager, Phake::times(2))->deleteRedirection(Phake::anyParameters());

Call to method when from undeclared class \Phake
Open

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

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

        $this->assertArrayHasKey(SiteEvents::SITE_CREATE, $this->subscriber->getSubscribedEvents());

Call to method anyParameters from undeclared class \Phake
Open

        Phake::verify($this->site, Phake::times(2))->removeAlias(Phake::anyParameters());

Call to method anyParameters from undeclared class \Phake
Open

        Phake::verify($this->redirectionManager, Phake::times(2))->generateRedirectionForNode(Phake::anyParameters());

Avoid excessively long class names like UpdateSiteAliasRedirectionSiteSubscriberTest. Keep class name length under 40.
Open

class UpdateSiteAliasRedirectionSiteSubscriberTest extends AbstractBaseTestCase
{
    /**
     * @var UpdateSiteAliasRedirectionSiteSubscriber
     */

LongClassName

Since: 2.9

Detects when classes or interfaces are declared with excessively long names.

Example

class ATooLongClassNameThatHintsAtADesignProblem {

}

interface ATooLongInterfaceNameThatHintsAtADesignProblem {

}

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

Line exceeds 120 characters; contains 123 characters
Open

        Phake::when($this->nodeRepository)->findLastVersionByType(Phake::anyParameters())->thenReturn(array($node, $node));

Line exceeds 120 characters; contains 145 characters
Open

        $this->subscriber = new UpdateSiteAliasRedirectionSiteSubscriber($this->objectManager, $this->redirectionManager, $this->nodeRepository);

There are no issues that match your filters.

Category
Status