open-orchestra/open-orchestra-cms-bundle

View on GitHub
ApiBundle/Tests/Transformer/ContentTransformerTest.php

Summary

Maintainability
B
4 hrs
Test Coverage

Method setUp has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function setUp()
    {
        $contentType0 = Phake::mock('OpenOrchestra\ModelInterface\Model\ContentTypeInterface');
        Phake::when($contentType0)->isDefiningVersionable()->thenReturn(true);
        $contentType1 = Phake::mock('OpenOrchestra\ModelInterface\Model\ContentTypeInterface');
Severity: Minor
Found in ApiBundle/Tests/Transformer/ContentTransformerTest.php - About 1 hr to fix

Method testTransform has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function testTransform(
        $id,
        $contentId,
        $contentType,
        $name,
Severity: Minor
Found in ApiBundle/Tests/Transformer/ContentTransformerTest.php - About 1 hr to fix

Method testTransform has 10 arguments (exceeds 4 allowed). Consider refactoring.
Open

        $id,
        $contentId,
        $contentType,
        $name,
        $version,
Severity: Major
Found in ApiBundle/Tests/Transformer/ContentTransformerTest.php - About 1 hr to fix

The method testTransform has 10 parameters. Consider reducing the number of parameters to less than 10.
Open

    public function testTransform(
        $id,
        $contentId,
        $contentType,
        $name,

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

        $attribute = Phake::mock('OpenOrchestra\ModelInterface\Model\ContentAttributeInterface');

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->authorizationChecker)->isGranted(Phake::anyParameters())->thenReturn(true);

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

        $facade = Phake::mock('OpenOrchestra\ApiBundle\Facade\ContentFacade');

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

        $contentType1 = Phake::mock('OpenOrchestra\ModelInterface\Model\ContentTypeInterface');

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->businessRulesManager = Phake::mock('OpenOrchestra\Backoffice\BusinessRules\BusinessRulesManager');

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

        Phake::when($status)->getLabel(Phake::anyParameters())->thenReturn('fakeStatus');

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->contentRepository)->findAllPublishedByContentId(Phake::anyParameters())->thenReturn(array());

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->statusRepository)->find(Phake::anyParameters())->thenReturn($status);

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

        $status = 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 'testTransform'.
Open

        Phake::verify($content, Phake::times(2))->getStatus();

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

        $router = Phake::mock('Symfony\Component\Routing\RouterInterface');

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->transformerManager = Phake::mock('OpenOrchestra\BaseApi\Transformer\TransformerManager');

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->businessRulesManager)->isGranted(Phake::anyParameters())->thenReturn(true);

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

        $status = 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 'setUp'.
Open

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

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

        $facade = Phake::mock('OpenOrchestra\BaseApi\Facade\FacadeInterface');

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->transformerManager)->transform(Phake::anyParameters())->thenReturn($facade);

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->authorizationChecker = Phake::mock('Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface');

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->contextManager = 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 'testTransform'.
Open

        $content = Phake::mock('OpenOrchestra\ModelInterface\Model\ContentInterface');

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->contentRepository = Phake::mock('OpenOrchestra\ModelBundle\Repository\ContentRepository');

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->contentRepository)->findOneByContentId(Phake::anyParameters())->thenReturn(Phake::mock('OpenOrchestra\ModelInterface\Model\ContentInterface'));

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

        $this->contentTransformer->transform(Phake::mock('stdClass'));

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($groupContext)->hasGroup(Phake::anyParameters())->thenReturn(true);

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->contentRepository)->find(Phake::anyParameters())->thenReturn(Phake::mock('OpenOrchestra\ModelInterface\Model\ContentInterface'));

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->contentRepository)->find(Phake::anyParameters())->thenReturn(Phake::mock('OpenOrchestra\ModelInterface\Model\ContentInterface'));

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->contentRepository)->findOneByContentId(Phake::anyParameters())->thenReturn(Phake::mock('OpenOrchestra\ModelInterface\Model\ContentInterface'));

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

        $contentType0 = Phake::mock('OpenOrchestra\ModelInterface\Model\ContentTypeInterface');

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

        $transformer = Phake::mock('OpenOrchestra\BaseApi\Transformer\TransformerInterface');

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

        $groupContext = Phake::mock('OpenOrchestra\BaseApi\Context\GroupContext');

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->contextManager = Phake::mock('OpenOrchestra\Backoffice\Context\ContextBackOfficeInterface');

Call to method when from undeclared class \Phake
Open

        Phake::when($this->businessRulesManager)->isGranted(Phake::anyParameters())->thenReturn(true);

Call to method when from undeclared class \Phake
Open

        Phake::when($content)->getContentId()->thenReturn($contentId);

Reference to instance property id from undeclared class \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open

        $this->assertSame($id, $facade->id);

Call to method mock from undeclared class \Phake
Open

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

Call to method when from undeclared class \Phake
Open

        Phake::when($this->statusRepository)->find(Phake::anyParameters())->thenReturn($status);

Call to method anyParameters from undeclared class \Phake
Open

        Phake::when($groupContext)->hasGroup(Phake::anyParameters())->thenReturn(true);

Call to method mock from undeclared class \Phake
Open

        $facade = Phake::mock('OpenOrchestra\BaseApi\Facade\FacadeInterface');

Call to method when from undeclared class \Phake
Open

        Phake::when($content)->isLinkedToSite()->thenReturn($linkedToSite);

Call to method anyParameters from undeclared class \Phake
Open

        Phake::when($status)->getLabel(Phake::anyParameters())->thenReturn('fakeStatus');

Reference to instance property version from undeclared class \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open

        $this->assertSame($version, $facade->version);

Call to undeclared method \OpenOrchestra\ApiBundle\Tests\Transformer\ContentTransformerTest::assertNull
Open

        $this->assertNull($result);

Call to method mock from undeclared class \Phake
Open

        $transformer = Phake::mock('OpenOrchestra\BaseApi\Transformer\TransformerInterface');

Call to method mock from undeclared class \Phake
Open

        $this->contentRepository = Phake::mock('OpenOrchestra\ModelBundle\Repository\ContentRepository');

Call to method mock from undeclared class \Phake
Open

        Phake::when($this->contentRepository)->find(Phake::anyParameters())->thenReturn(Phake::mock('OpenOrchestra\ModelInterface\Model\ContentInterface'));

Reference to instance property statusLabel from undeclared class \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open

        $this->assertSame($facade->status->label, $facade->statusLabel);

Call to method getRights from undeclared class \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open

        $this->assertArrayHasKey('can_edit', $facade->getRights());

Call to undeclared method \OpenOrchestra\ApiBundle\Tests\Transformer\ContentTransformerTest::assertArrayHasKey
Open

        $this->assertArrayHasKey('can_edit', $facade->getRights());

Possibly zero references to use statement for classlike/namespace FacadeInterface (\OpenOrchestra\BaseApi\Facade\FacadeInterface)
Open

use OpenOrchestra\BaseApi\Facade\FacadeInterface;

Call to method mock from undeclared class \Phake
Open

        $contentType1 = Phake::mock('OpenOrchestra\ModelInterface\Model\ContentTypeInterface');

Call to method mock from undeclared class \Phake
Open

        $this->transformerManager = Phake::mock('OpenOrchestra\BaseApi\Transformer\TransformerManager');

Call to method when from undeclared class \Phake
Open

        Phake::when($content)->getAttributes()->thenReturn(array($attribute, $attribute));

Call to method when from undeclared class \Phake
Open

        Phake::when($content)->getContentType()->thenReturn($contentType);

Call to method when from undeclared class \Phake
Open

        Phake::when($content)->getLanguage()->thenReturn($language);

Call to undeclared method \OpenOrchestra\ApiBundle\Tests\Transformer\ContentTransformerTest::assertArrayHasKey
Open

        $this->assertArrayHasKey('can_delete', $facade->getRights());

Call to method mock from undeclared class \Phake
Open

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

Call to method when from undeclared class \Phake
Open

        Phake::when($transformer)->getContext()->thenReturn($this->transformerManager);

Call to method anyParameters from undeclared class \Phake
Open

        Phake::when($this->authorizationChecker)->isGranted(Phake::anyParameters())->thenReturn(true);

Call to method when from undeclared class \Phake
Open

        Phake::when($this->contentRepository)->find(Phake::anyParameters())->thenReturn(Phake::mock('OpenOrchestra\ModelInterface\Model\ContentInterface'));

Call to method when from undeclared class \Phake
Open

        Phake::when($status)->getLabel(Phake::anyParameters())->thenReturn('fakeStatus');

Call to undeclared method \OpenOrchestra\ApiBundle\Tests\Transformer\ContentTransformerTest::assertSame
Open

        $this->assertSame($contentId, $facade->contentId);

Call to undeclared method \OpenOrchestra\ApiBundle\Tests\Transformer\ContentTransformerTest::assertSame
Open

        $this->assertSame($name, $facade->name);

Call to undeclared method \OpenOrchestra\ApiBundle\Tests\Transformer\ContentTransformerTest::assertSame
Open

        $this->assertSame($deleted, $facade->deleted);

Call to method getRights from undeclared class \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open

        $this->assertArrayHasKey('can_duplicate', $facade->getRights());

Call to undeclared method \OpenOrchestra\ApiBundle\Tests\Transformer\ContentTransformerTest::expectException
Open

        $this->expectException('OpenOrchestra\BaseApi\Exceptions\TransformerParameterTypeException');

Call to method when from undeclared class \Phake
Open

        Phake::when($contentType0)->isDefiningVersionable()->thenReturn(true);

Call to method when from undeclared class \Phake
Open

        Phake::when($this->transformerManager)->getRouter()->thenReturn($router);

Call to method when from undeclared class \Phake
Open

        Phake::when($this->contentRepository)->findOneByContentId(Phake::anyParameters())->thenReturn(Phake::mock('OpenOrchestra\ModelInterface\Model\ContentInterface'));

Call to method mock from undeclared class \Phake
Open

        $this->businessRulesManager = Phake::mock('OpenOrchestra\Backoffice\BusinessRules\BusinessRulesManager');

Call to method mock from undeclared class \Phake
Open

        $attribute = Phake::mock('OpenOrchestra\ModelInterface\Model\ContentAttributeInterface');

Reference to instance property name from undeclared class \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open

        $this->assertSame($name, $facade->name);

Call to method verify from undeclared class \Phake
Open

        Phake::verify($this->contentRepository)->findById('fakeId');

Call to method when from undeclared class \Phake
Open

        Phake::when($this->transformerManager)->transform(Phake::anyParameters())->thenReturn($facade);

Call to method mock from undeclared class \Phake
Open

        $groupContext = Phake::mock('OpenOrchestra\BaseApi\Context\GroupContext');

Call to method when from undeclared class \Phake
Open

        Phake::when($content)->getVersion()->thenReturn($version);

Call to method when from undeclared class \Phake
Open

        Phake::when($content)->getCreatedAt()->thenReturn($creationDate);

Reference to instance property language from undeclared class \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open

        $this->assertSame($language, $facade->language);

Call to undeclared method \OpenOrchestra\ApiBundle\Tests\Transformer\ContentTransformerTest::assertSame
Open

        $this->assertSame($updateDate, $facade->updatedAt);

Call to undeclared method \OpenOrchestra\ApiBundle\Tests\Transformer\ContentTransformerTest::assertSame
Open

        $this->assertSame($facade->status->label, $facade->statusLabel);

Call to method when from undeclared class \Phake
Open

        Phake::when($groupContext)->hasGroup(Phake::anyParameters())->thenReturn(true);

Call to method mock from undeclared class \Phake
Open

        $this->authorizationChecker = Phake::mock('Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface');

Call to method anyParameters from undeclared class \Phake
Open

        Phake::when($this->contentRepository)->findAllPublishedByContentId(Phake::anyParameters())->thenReturn(array());

Call to method anyParameters from undeclared class \Phake
Open

        Phake::when($this->contentRepository)->findOneByContentId(Phake::anyParameters())->thenReturn(Phake::mock('OpenOrchestra\ModelInterface\Model\ContentInterface'));

Call to method when from undeclared class \Phake
Open

        Phake::when($content)->getUpdatedAt()->thenReturn($updateDate);

Call to undeclared method \OpenOrchestra\ApiBundle\Tests\Transformer\ContentTransformerTest::assertSame
Open

        $this->assertSame($language, $facade->language);

Call to method getRights from undeclared class \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open

        $this->assertArrayHasKey('can_delete', $facade->getRights());

Call to undeclared method \OpenOrchestra\ApiBundle\Tests\Transformer\ContentTransformerTest::assertArrayHasKey
Open

        $this->assertArrayHasKey('can_duplicate', $facade->getRights());

Call to method mock from undeclared class \Phake
Open

        $contentType0 = Phake::mock('OpenOrchestra\ModelInterface\Model\ContentTypeInterface');

Reference to instance property deleted from undeclared class \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open

        $this->assertSame($deleted, $facade->deleted);

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

class ContentTransformerTest extends AbstractBaseTestCase

Call to method when from undeclared class \Phake
Open

        Phake::when($contentType1)->isDefiningVersionable()->thenReturn(false);

Reference to instance property contentId from undeclared class \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open

        $this->assertSame($contentId, $facade->contentId);

Call to method mock from undeclared class \Phake
Open

        $facade = Phake::mock('OpenOrchestra\ApiBundle\Facade\ContentFacade');

Call to method anyParameters from undeclared class \Phake
Open

        Phake::when($this->contentRepository)->find(Phake::anyParameters())->thenReturn(Phake::mock('OpenOrchestra\ModelInterface\Model\ContentInterface'));

Call to method when from undeclared class \Phake
Open

        Phake::when($this->contentRepository)->findAllPublishedByContentId(Phake::anyParameters())->thenReturn(array());

Call to method when from undeclared class \Phake
Open

        Phake::when($content)->isDeleted()->thenReturn($deleted);

Call to method when from undeclared class \Phake
Open

        Phake::when($content)->getStatus()->thenReturn($status);

Call to undeclared method \OpenOrchestra\ApiBundle\Tests\Transformer\ContentTransformerTest::assertSame
Open

        $this->assertSame($version, $facade->version);

Call to undeclared method \OpenOrchestra\ApiBundle\Tests\Transformer\ContentTransformerTest::assertSame
Open

        $this->assertSame($linkedToSite, $facade->linkedToSite);

Possibly zero references to use statement for classlike/namespace ContentInterface (\OpenOrchestra\ModelInterface\Model\ContentInterface)
Open

use OpenOrchestra\ModelInterface\Model\ContentInterface;

Call to method mock from undeclared class \Phake
Open

        $router = Phake::mock('Symfony\Component\Routing\RouterInterface');

Call to method when from undeclared class \Phake
Open

        Phake::when($this->authorizationChecker)->isGranted(Phake::anyParameters())->thenReturn(true);

Call to method mock from undeclared class \Phake
Open

        Phake::when($this->contentRepository)->findOneByContentId(Phake::anyParameters())->thenReturn(Phake::mock('OpenOrchestra\ModelInterface\Model\ContentInterface'));

Call to undeclared method \OpenOrchestra\ApiBundle\Transformer\ContentTransformer::setContext
Open

        $this->contentTransformer->setContext($this->transformerManager);

Call to undeclared method \OpenOrchestra\ApiBundle\Tests\Transformer\ContentTransformerTest::assertSame
Open

        $this->assertSame($creationDate, $facade->createdAt);

Call to undeclared method \OpenOrchestra\ApiBundle\Tests\Transformer\ContentTransformerTest::assertInstanceOf
Open

        $this->assertInstanceOf('OpenOrchestra\ApiBundle\Facade\ContentFacade', $facade);

Call to method mock from undeclared class \Phake
Open

        $this->contentTransformer->transform(Phake::mock('stdClass'));

Call to method mock from undeclared class \Phake
Open

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

Reference to instance property updatedAt from undeclared class \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open

        $this->assertSame($updateDate, $facade->updatedAt);

Call to method times from undeclared class \Phake
Open

        Phake::verify($content, Phake::times(2))->getStatus();

Call to method verify from undeclared class \Phake
Open

        Phake::verify($content, Phake::times(2))->getStatus();

Call to method anyParameters from undeclared class \Phake
Open

        Phake::when($this->statusRepository)->find(Phake::anyParameters())->thenReturn($status);

Call to method when from undeclared class \Phake
Open

        Phake::when($this->contextManager)->getBackOfficeLanguage()->thenReturn('en');

Reference to instance property createdAt from undeclared class \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open

        $this->assertSame($creationDate, $facade->createdAt);

Reference to instance property status from undeclared class \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open

        $this->assertSame($facade->status->label, $facade->statusLabel);

Call to undeclared method \OpenOrchestra\ApiBundle\Tests\Transformer\ContentTransformerTest::assertSame
Open

        $this->assertSame($id, $facade->id);

Call to method verify from undeclared class \Phake
Open

        Phake::verify($this->authorizationChecker)->isGranted(ContributionActionInterface::EDIT, $content);

Call to method anyParameters from undeclared class \Phake
Open

        Phake::when($this->transformerManager)->transform(Phake::anyParameters())->thenReturn($facade);

Call to method when from undeclared class \Phake
Open

        Phake::when($this->transformerManager)->getGroupContext()->thenReturn($groupContext);

Call to method anyParameters from undeclared class \Phake
Open

        Phake::when($this->businessRulesManager)->isGranted(Phake::anyParameters())->thenReturn(true);

Call to method mock from undeclared class \Phake
Open

        $content = Phake::mock('OpenOrchestra\ModelInterface\Model\ContentInterface');

Call to method when from undeclared class \Phake
Open

        Phake::when($content)->getId()->thenReturn($id);

Call to method when from undeclared class \Phake
Open

        Phake::when($content)->getName()->thenReturn($name);

Call to method when from undeclared class \Phake
Open

        Phake::when($status)->isBlocked()->thenReturn(false);

Reference to instance property linkedToSite from undeclared class \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open

        $this->assertSame($linkedToSite, $facade->linkedToSite);

Call to undeclared method \OpenOrchestra\ApiBundle\Tests\Transformer\ContentTransformerTest::assertSame
Open

        $this->assertSame('content', $this->contentTransformer->getName());

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

        $id,

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 129 characters
Open

        $this->authorizationChecker = Phake::mock('Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface');

Line exceeds 120 characters; contains 170 characters
Open

        Phake::when($this->contentRepository)->findOneByContentId(Phake::anyParameters())->thenReturn(Phake::mock('OpenOrchestra\ModelInterface\Model\ContentInterface'));

Line exceeds 120 characters; contains 156 characters
Open

        Phake::when($this->contentRepository)->find(Phake::anyParameters())->thenReturn(Phake::mock('OpenOrchestra\ModelInterface\Model\ContentInterface'));

There are no issues that match your filters.

Category
Status