open-orchestra/open-orchestra-cms-bundle

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

Summary

Maintainability
A
0 mins
Test Coverage

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 'provideSpecialPagesNode'.
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

        $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 'testPreSetData'.
Open

        Phake::when($this->nodeRepository)->findAllSpecialPage(Phake::anyParameters())->thenReturn($specialPagesNode);

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

        $data = 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

        $currentSiteManager = Phake::mock('OpenOrchestra\Backoffice\Context\ContextBackOfficeInterface');

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

        Phake::when($data)->getSpecialPageName()->thenReturn('default');

Call to method when 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->event)->getData()->thenReturn($data);

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

        $currentSiteManager = Phake::mock('OpenOrchestra\Backoffice\Context\ContextBackOfficeInterface');

Call to method anyParameters from undeclared class \Phake
Open

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

Call to method mock from undeclared class \Phake
Open

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

Call to method verify from undeclared class \Phake
Open

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

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

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

Call to method mock from undeclared class \Phake
Open

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

Call to method mock from undeclared class \Phake
Open

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

Class extends undeclared class \PHPUnit_Framework_TestCase
Open

class SpecialPageChoiceSubscriberTest extends \PHPUnit_Framework_TestCase

Call to method mock from undeclared class \Phake
Open

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

Parameter $data has undeclared type \OpenOrchestra\ModelInterface\Model\NodeInterface
Open

    public function testPreSetData($data, array $specialPagesNode, array $expectedSpecialPageList)

Call to method when from undeclared class \Phake
Open

        Phake::when($this->nodeRepository)->findAllSpecialPage(Phake::anyParameters())->thenReturn($specialPagesNode);

Call to method when from undeclared class \Phake
Open

        Phake::when($node)->getSpecialPageName()->thenReturn('default');

Call to method anyParameters from undeclared class \Phake
Open

        Phake::when($this->nodeRepository)->findAllSpecialPage(Phake::anyParameters())->thenReturn($specialPagesNode);

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

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

Call to method when from undeclared class \Phake
Open

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

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

    public function testPreSetData($data, array $specialPagesNode, array $expectedSpecialPageList)

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

There are no issues that match your filters.

Category
Status