open-orchestra/open-orchestra-cms-bundle

View on GitHub
WorkflowAdminBundle/Tests/BusinessRules/Strategies/StatusStrategyTest.php

Summary

Maintainability
A
1 hr
Test Coverage

Method provideStatusAndUsage has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function provideStatusAndUsage()
    {
        $status0 = Phake::mock('OpenOrchestra\ModelInterface\Model\StatusInterface');
        Phake::when($status0)->isInitialState()->thenReturn(true);
        Phake::when($status0)->isPublishedState()->thenReturn(false);

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

        $this->statusUsageFinder = Phake::mock('OpenOrchestra\Backoffice\UsageFinder\StatusUsageFinder');

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

        $status2 = 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 'provideStatusAndUsage'.
Open

        $status4 = 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 'provideStatusAndUsage'.
Open

        $status1 = 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 'provideStatusAndUsage'.
Open

        $status5 = 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 'testCanDelete'.
Open

        Phake::when($this->statusUsageFinder)->hasUsage(Phake::anyParameters())->thenReturn($hasUsage);

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

        $status0 = 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 'provideStatusAndUsage'.
Open

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

Call to method when from undeclared class \Phake
Open

        Phake::when($status5)->isPublishedState()->thenReturn(false);

Call to method anyParameters from undeclared class \Phake
Open

        Phake::when($this->statusUsageFinder)->hasUsage(Phake::anyParameters())->thenReturn($hasUsage);

Call to method when from undeclared class \Phake
Open

        Phake::when($status0)->isInitialState()->thenReturn(true);

Call to method when from undeclared class \Phake
Open

        Phake::when($status4)->isAutoPublishFromState()->thenReturn(false);

Call to undeclared method \OpenOrchestra\GroupBundle\Tests\BusinessRules\Strategies\StatusStrategyTest::assertEquals
Open

        $this->assertEquals(StatusInterface::ENTITY_TYPE, $this->strategy->getType());

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

class StatusStrategyTest extends AbstractBaseTestCase

Call to method mock from undeclared class \Phake
Open

        $this->statusUsageFinder = Phake::mock('OpenOrchestra\Backoffice\UsageFinder\StatusUsageFinder');

Call to method when from undeclared class \Phake
Open

        Phake::when($this->statusUsageFinder)->hasUsage(Phake::anyParameters())->thenReturn($hasUsage);

Call to method when from undeclared class \Phake
Open

        Phake::when($status0)->isTranslationState()->thenReturn(false);

Call to method when from undeclared class \Phake
Open

        Phake::when($status0)->isPublishedState()->thenReturn(false);

Call to method mock from undeclared class \Phake
Open

        $status2 = Phake::mock('OpenOrchestra\ModelInterface\Model\StatusInterface');

Call to method when from undeclared class \Phake
Open

        Phake::when($status3)->isTranslationState()->thenReturn(false);

Call to method when from undeclared class \Phake
Open

        Phake::when($status4)->isPublishedState()->thenReturn(false);

Call to method when from undeclared class \Phake
Open

        Phake::when($status5)->isInitialState()->thenReturn(false);

Reference to undeclared property \OpenOrchestra\GroupBundle\Tests\BusinessRules\Strategies\StatusStrategyTest->strategy
Open

        ), $this->strategy->getActions());

Call to method when from undeclared class \Phake
Open

        Phake::when($status2)->isPublishedState()->thenReturn(false);

Call to method mock from undeclared class \Phake
Open

        $status4 = Phake::mock('OpenOrchestra\ModelInterface\Model\StatusInterface');

Call to method when from undeclared class \Phake
Open

        Phake::when($status4)->isTranslationState()->thenReturn(false);

Parameter $status has undeclared type \OpenOrchestra\ModelInterface\Model\StatusInterface
Open

    public function testCanDelete(StatusInterface $status, $hasUsage, $isGranted)

Call to method when from undeclared class \Phake
Open

        Phake::when($status0)->isAutoUnpublishToState()->thenReturn(false);

Call to method when from undeclared class \Phake
Open

        Phake::when($status3)->isAutoPublishFromState()->thenReturn(true);

Call to method when from undeclared class \Phake
Open

        Phake::when($status3)->isAutoUnpublishToState()->thenReturn(false);

Call to method mock from undeclared class \Phake
Open

        $status5 = Phake::mock('OpenOrchestra\ModelInterface\Model\StatusInterface');

Call to method when from undeclared class \Phake
Open

        Phake::when($status3)->isInitialState()->thenReturn(false);

Call to method when from undeclared class \Phake
Open

        Phake::when($status4)->isAutoUnpublishToState()->thenReturn(true);

Call to method when from undeclared class \Phake
Open

        Phake::when($status5)->isAutoPublishFromState()->thenReturn(false);

Call to method when from undeclared class \Phake
Open

        Phake::when($status5)->isAutoUnpublishToState()->thenReturn(false);

Call to method when from undeclared class \Phake
Open

        Phake::when($status1)->isTranslationState()->thenReturn(false);

Call to method when from undeclared class \Phake
Open

        Phake::when($status1)->isAutoUnpublishToState()->thenReturn(false);

Call to method mock from undeclared class \Phake
Open

        $status0 = Phake::mock('OpenOrchestra\ModelInterface\Model\StatusInterface');

Call to method when from undeclared class \Phake
Open

        Phake::when($status0)->isAutoPublishFromState()->thenReturn(false);

Call to method when from undeclared class \Phake
Open

        Phake::when($status2)->isAutoUnpublishToState()->thenReturn(false);

Call to undeclared method \OpenOrchestra\GroupBundle\Tests\BusinessRules\Strategies\StatusStrategyTest::assertEquals
Open

        $this->assertEquals(array(

Reference to undeclared property \OpenOrchestra\GroupBundle\Tests\BusinessRules\Strategies\StatusStrategyTest->strategy
Open

        $this->strategy = new StatusStrategy($this->statusUsageFinder);

Call to method when from undeclared class \Phake
Open

        Phake::when($status1)->isInitialState()->thenReturn(false);

Call to method when from undeclared class \Phake
Open

        Phake::when($status1)->isAutoPublishFromState()->thenReturn(false);

Reference to constant ENTITY_TYPE from undeclared class \OpenOrchestra\ModelInterface\Model\StatusInterface
Open

        $this->assertEquals(StatusInterface::ENTITY_TYPE, $this->strategy->getType());

Call to method when from undeclared class \Phake
Open

        Phake::when($status2)->isAutoPublishFromState()->thenReturn(false);

Reference to undeclared property \OpenOrchestra\GroupBundle\Tests\BusinessRules\Strategies\StatusStrategyTest->strategy
Open

        $this->assertEquals(StatusInterface::ENTITY_TYPE, $this->strategy->getType());

Reference to undeclared property \OpenOrchestra\GroupBundle\Tests\BusinessRules\Strategies\StatusStrategyTest->strategy
Open

        $this->assertSame($isGranted, $this->strategy->canDelete($status, array()));

Call to undeclared method \OpenOrchestra\GroupBundle\Tests\BusinessRules\Strategies\StatusStrategyTest::assertSame
Open

        $this->assertSame($isGranted, $this->strategy->canDelete($status, array()));

Call to method when from undeclared class \Phake
Open

        Phake::when($status2)->isInitialState()->thenReturn(false);

Call to method when from undeclared class \Phake
Open

        Phake::when($status2)->isTranslationState()->thenReturn(true);

Call to method when from undeclared class \Phake
Open

        Phake::when($status3)->isPublishedState()->thenReturn(false);

Call to method mock from undeclared class \Phake
Open

        $status1 = Phake::mock('OpenOrchestra\ModelInterface\Model\StatusInterface');

Call to method mock from undeclared class \Phake
Open

        $status3 = Phake::mock('OpenOrchestra\ModelInterface\Model\StatusInterface');

Call to method when from undeclared class \Phake
Open

        Phake::when($status1)->isPublishedState()->thenReturn(true);

Call to method when from undeclared class \Phake
Open

        Phake::when($status4)->isInitialState()->thenReturn(false);

Call to method when from undeclared class \Phake
Open

        Phake::when($status5)->isTranslationState()->thenReturn(false);

There are no issues that match your filters.

Category
Status