open-orchestra/open-orchestra-cms-bundle

View on GitHub
UserAdminBundle/Tests/Security/OrchestraUserCheckerTest.php

Summary

Maintainability
A
0 mins
Test Coverage

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

        $user = Phake::mock(UserInterface::class);

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

        $user = Phake::mock('OpenOrchestra\UserBundle\Model\UserInterface');

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($user)->isAccountNonLocked()->thenReturn(true);

Call to method when from undeclared class \Phake
Open

        Phake::when($user)->isAccountNonExpired()->thenReturn(true);

Parameter $user has undeclared type \Symfony\Component\Security\Core\User\UserInterface
Open

    public function testCheckPreAuth(UserInterface $user, $expectedException)

Call to method when from undeclared class \Phake
Open

        Phake::when($user)->getRoles()->thenReturn($roles);

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

class OrchestraUserCheckerTest extends AbstractBaseTestCase

Call to undeclared method \OpenOrchestra\UserAdminBundle\Tests\Security\OrchestraUserCheckerTest::expectException
Open

            $this->expectException('OpenOrchestra\UserAdminBundle\Exception\NoRolesException');

Call to method when from undeclared class \Phake
Open

        Phake::when($user)->isEnabled()->thenReturn(true);

Reference to constant ROLE_DEFAULT from undeclared class \FOS\UserBundle\Model\UserInterface
Open

        $userRoleDefault = $this->createMockUser(array(\FOS\UserBundle\Model\UserInterface::ROLE_DEFAULT));

Call to method when from undeclared class \Phake
Open

        Phake::when($user)->isAccountNonExpired()->thenReturn(true);

Reference to constant class from undeclared class \Symfony\Component\Security\Core\User\UserInterface
Open

        $user = Phake::mock(UserInterface::class);

Reference to constant ROLE_DEFAULT from undeclared class \FOS\UserBundle\Model\UserInterface
Open

        Phake::when($userRoleDefault)->hasRole(\FOS\UserBundle\Model\UserInterface::ROLE_DEFAULT)->thenReturn(true);

Call to undeclared method \OpenOrchestra\UserAdminBundle\Tests\Security\OrchestraUserCheckerTest::assertNull
Open

        $this->assertNull($this->userChecker->checkPreAuth($user));

Call to method when from undeclared class \Phake
Open

        Phake::when($user)->isEnabled()->thenReturn(true);

Call to method mock from undeclared class \Phake
Open

        $user = Phake::mock(UserInterface::class);

Call to method when from undeclared class \Phake
Open

        Phake::when($userRoleDefault)->hasRole(\FOS\UserBundle\Model\UserInterface::ROLE_DEFAULT)->thenReturn(true);

Call to method mock from undeclared class \Phake
Open

        $user = Phake::mock('OpenOrchestra\UserBundle\Model\UserInterface');

Call to method when from undeclared class \Phake
Open

        Phake::when($user)->isAccountNonLocked()->thenReturn(true);

There are no issues that match your filters.

Category
Status