open-orchestra/open-orchestra-cms-bundle

View on GitHub
GroupBundle/Tests/BusinessRules/Strategies/GroupStrategyTest.php

Summary

Maintainability
A
0 mins
Test Coverage

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

        $group1 = Phake::mock('OpenOrchestra\Backoffice\Model\GroupInterface');

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

        $group0 = Phake::mock('OpenOrchestra\Backoffice\Model\GroupInterface');

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->userRepository = Phake::mock('OpenOrchestra\UserBundle\Repository\UserRepositoryInterface');

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->userRepository = Phake::mock('OpenOrchestra\UserBundle\Repository\UserRepositoryInterface');

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

        $this->strategy = new GroupStrategy($this->userRepository);

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

        $this->assertEquals(array(

Call to method when from undeclared class \Phake
Open

        Phake::when($group0)->getId()->thenReturn($this->idGroup0);

Call to method mock from undeclared class \Phake
Open

        $group1 = Phake::mock('OpenOrchestra\Backoffice\Model\GroupInterface');

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

class GroupStrategyTest extends AbstractBaseTestCase

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

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

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

        $this->assertSame($isGranted, $this->strategy->canDelete($group, $parameters));

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

        $this->assertSame($isGranted, $this->strategy->canDelete($group, $parameters));

Call to method mock from undeclared class \Phake
Open

        $group0 = Phake::mock('OpenOrchestra\Backoffice\Model\GroupInterface');

Call to method when from undeclared class \Phake
Open

        Phake::when($group1)->getId()->thenReturn($this->idGroup1);

Call to method when from undeclared class \Phake
Open

        Phake::when($this->userRepository)->getCountsUsersByGroups(array($this->idGroup0))->thenReturn(array($this->idGroup0 => 0));

Call to method when from undeclared class \Phake
Open

        Phake::when($this->userRepository)->getCountsUsersByGroups(array($this->idGroup1))->thenReturn(array($this->idGroup1 => 1));

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

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

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

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

Line exceeds 120 characters; contains 132 characters
Open

        Phake::when($this->userRepository)->getCountsUsersByGroups(array($this->idGroup1))->thenReturn(array($this->idGroup1 => 1));

Line exceeds 120 characters; contains 132 characters
Open

        Phake::when($this->userRepository)->getCountsUsersByGroups(array($this->idGroup0))->thenReturn(array($this->idGroup0 => 0));

There are no issues that match your filters.

Category
Status