open-orchestra/open-orchestra-cms-bundle

View on GitHub
LogBundle/Tests/Processor/LogUserProcessorTest.php

Summary

Maintainability
A
0 mins
Test Coverage

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

        $this->requestStack = Phake::mock('Symfony\Component\HttpFoundation\RequestStack');

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->context = 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

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

        $this->token = Phake::mock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface');

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->request = Phake::mock('Symfony\Component\HttpFoundation\Request');

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->security = Phake::mock('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface');

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->requestStack = Phake::mock('Symfony\Component\HttpFoundation\RequestStack');

Call to method when from undeclared class \Phake
Open

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

Call to method mock from undeclared class \Phake
Open

        $this->security = Phake::mock('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface');

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

class LogUserProcessorTest extends AbstractBaseTestCase

Call to undeclared method \OpenOrchestra\LogBundle\Tests\Processor\LogUserProcessorTest::assertSame
Open

        $this->assertSame($result, array('extra' => array(

Call to method mock from undeclared class \Phake
Open

        $this->token = Phake::mock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface');

Call to method when from undeclared class \Phake
Open

        Phake::when($this->token)->getUsername()->thenReturn($this->userName);

Call to method mock from undeclared class \Phake
Open

        $this->request = Phake::mock('Symfony\Component\HttpFoundation\Request');

Call to method mock from undeclared class \Phake
Open

        $this->context = Phake::mock('OpenOrchestra\Backoffice\Context\ContextBackOfficeInterface');

Call to method when from undeclared class \Phake
Open

        Phake::when($this->context)->getSiteName()->thenReturn($this->siteName);

Call to method when from undeclared class \Phake
Open

        Phake::when($this->request)->getClientIp()->thenReturn($this->ip);

Call to method when from undeclared class \Phake
Open

        Phake::when($this->security)->getToken()->thenReturn($this->token);

Call to method when from undeclared class \Phake
Open

        Phake::when($this->requestStack)->getCurrentRequest()->thenReturn($this->request);

Call to undeclared method \OpenOrchestra\LogBundle\Tests\Processor\LogUserProcessorTest::assertSame
Open

        $this->assertSame($result, array('extra' => array(

Avoid variables with short names like $ip. Configured minimum length is 3.
Open

    protected $ip = '192.168.33.10';

ShortVariable

Since: 0.2

Detects when a field, local, or parameter has a very short name.

Example

class Something {
    private $q = 15; // VIOLATION - Field
    public static function main( array $as ) { // VIOLATION - Formal
        $r = 20 + $this->q; // VIOLATION - Local
        for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
            $r += $this->q;
        }
    }
}

Source https://phpmd.org/rules/naming.html#shortvariable

Line exceeds 120 characters; contains 124 characters
Open

        $this->security = Phake::mock('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface');

There are no issues that match your filters.

Category
Status