open-orchestra/open-orchestra-cms-bundle

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

Summary

Maintainability
A
1 hr
Test Coverage

Method testPreSetData has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function testPreSetData($siteId, $disabled)
    {
        $templateSetChoices = array(
            'fakeTemplateSet' => 'fakeTemplateSet'
        );

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

        $this->form = Phake::mock('Symfony\Component\Form\Form');

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->data = 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->event = Phake::mock('Symfony\Component\Form\FormEvent');

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->form)->get(Phake::anyParameters())->thenReturn($this->form);

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->templateManager = Phake::mock('OpenOrchestra\Backoffice\Manager\TemplateManager');

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

        Phake::verify($this->form)->add('templateSet', 'choice', array(

Reference to constant PRE_SET_DATA from undeclared class \Symfony\Component\Form\FormEvents
Open

        $this->assertArrayHasKey(FormEvents::PRE_SET_DATA, $this->subscriber->getSubscribedEvents());

Class extends undeclared class \PHPUnit_Framework_TestCase
Open

class WebSiteNodeTemplateSubscriberTest extends \PHPUnit_Framework_TestCase

Reference to undeclared property \OpenOrchestra\Backoffice\Tests\EventSubscriber\WebSiteNodeTemplateSubscriberTest->templateManager
Open

        Phake::when($this->templateManager)->getTemplateSetParameters()->thenReturn(array(

Call to method when from undeclared class \Phake
Open

        Phake::when($this->data)->getSiteId()->thenReturn($siteId);

Call to method mock from undeclared class \Phake
Open

        $this->event = Phake::mock('Symfony\Component\Form\FormEvent');

Call to method when from undeclared class \Phake
Open

        Phake::when($this->event)->getForm()->thenReturn($this->form);

Call to method mock from undeclared class \Phake
Open

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

Call to method when from undeclared class \Phake
Open

        Phake::when($this->event)->getData()->thenReturn($this->data);

Reference to undeclared property \OpenOrchestra\Backoffice\Tests\EventSubscriber\WebSiteNodeTemplateSubscriberTest->templateManager
Open

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

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

        $this->assertArrayHasKey(FormEvents::PRE_SET_DATA, $this->subscriber->getSubscribedEvents());

Call to method mock from undeclared class \Phake
Open

        $this->form = Phake::mock('Symfony\Component\Form\Form');

Call to method verify from undeclared class \Phake
Open

        Phake::verify($this->form)->add('templateNodeRoot', 'choice', array(

Reference to undeclared property \OpenOrchestra\Backoffice\Tests\EventSubscriber\WebSiteNodeTemplateSubscriberTest->templateManager
Open

        $this->subscriber = new WebSiteNodeTemplateSubscriber($this->templateManager);

Call to method when from undeclared class \Phake
Open

        Phake::when($this->templateManager)->getTemplateSetParameters()->thenReturn(array(

Call to method mock from undeclared class \Phake
Open

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

Call to method anyParameters from undeclared class \Phake
Open

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

Call to method when from undeclared class \Phake
Open

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

There are no issues that match your filters.

Category
Status