open-orchestra/open-orchestra-cms-bundle

View on GitHub
Backoffice/Tests/Form/DataTransformer/ReferenceToEmbedTransformerTest.php

Summary

Maintainability
A
0 mins
Test Coverage

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

        $entityDbMapper = Phake::mock('OpenOrchestra\ModelInterface\Manager\EntityDbMapperInterface');

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

        $objectManager = Phake::mock('Doctrine\Common\Persistence\ObjectManager');

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 undeclared method \OpenOrchestra\Backoffice\Tests\Form\DataTransformer\ReferenceToEmbedTransformerTest::assertInstanceOf
Open

        $this->assertInstanceOf('Symfony\Component\Form\DataTransformerInterface', $this->transformer);

Call to method mock from undeclared class \Phake
Open

        $entityDbMapper = Phake::mock('OpenOrchestra\ModelInterface\Manager\EntityDbMapperInterface');

Reference to undeclared property \OpenOrchestra\Backoffice\Tests\Form\DataTransformer\ReferenceToEmbedTransformerTest->transformData
Open

        $this->assertSame($this->transformData, $this->transformer->transform($this->data));

Reference to undeclared property \OpenOrchestra\Backoffice\Tests\Form\DataTransformer\ReferenceToEmbedTransformerTest->transformData
Open

        $this->assertSame($this->data, $this->transformer->reverseTransform($this->transformData));

Call to method when from undeclared class \Phake
Open

        Phake::when($objectManager)->find($this->documentClass, $this->id)->thenReturn($this->document);

Call to method when from undeclared class \Phake
Open

        Phake::when($entityDbMapper)->fromDbToEntity($this->data)->thenReturn($this->document);

Call to method when from undeclared class \Phake
Open

        Phake::when($entityDbMapper)->fromEntityToDb($this->document)->thenReturn($this->data);

Call to undeclared method \OpenOrchestra\Backoffice\Tests\Form\DataTransformer\ReferenceToEmbedTransformerTest::assertSame
Open

        $this->assertSame($this->data, $this->transformer->reverseTransform($this->transformData));

Call to undeclared method \OpenOrchestra\Backoffice\Tests\Form\DataTransformer\ReferenceToEmbedTransformerTest::assertSame
Open

        $this->assertSame($this->transformData, $this->transformer->transform($this->data));

Call to method mock from undeclared class \Phake
Open

        $objectManager = Phake::mock('Doctrine\Common\Persistence\ObjectManager');

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

class ReferenceToEmbedTransformerTest extends AbstractBaseTestCase

Reference to undeclared property \OpenOrchestra\Backoffice\Tests\Form\DataTransformer\ReferenceToEmbedTransformerTest->transformData
Open

        $this->transformData = array($this->formTypeName => $this->id);

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

    public function __construct($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

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

    protected $id = 'fakeId';

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

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

    protected $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

Each class must be in a file by itself
Open

class FakeDocument

Opening brace should be on a new line
Open

    public function getId() {

Opening brace should be on a new line
Open

    public function __construct($id) {

There are no issues that match your filters.

Category
Status