open-orchestra/open-orchestra-cms-bundle

View on GitHub
GroupBundle/Tests/Form/DataTransformer/GroupListToArrayTransformerTest.php

Summary

Maintainability
A
0 mins
Test Coverage

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

        $this->groupRepository = Phake::mock('OpenOrchestra\GroupBundle\Repository\GroupRepository');

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

        $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 'testReverseTransformWithGroups'.
Open

        Phake::verify($this->groupRepository, Phake::times($numberOfFind))->find(Phake::anyParameters());

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

        $group = 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 'testReverseTransformWithGroups'.
Open

        Phake::verify($this->groupRepository, Phake::times($numberOfFind))->find(Phake::anyParameters());

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

Reference to undeclared property \OpenOrchestra\Backoffice\Tests\Form\DataTransformer\GroupListToArrayTransformerTest->transformer
Open

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

Call to method __construct from undeclared class \Doctrine\Common\Collections\ArrayCollection
Open

            array(new ArrayCollection(), array('groups_collection' => array())),

Call to undeclared method \OpenOrchestra\Backoffice\Tests\Form\DataTransformer\GroupListToArrayTransformerTest::assertInstanceOf
Open

        $this->assertInstanceOf('Doctrine\Common\Collections\ArrayCollection', $result);

Call to method times from undeclared class \Phake
Open

        Phake::verify($this->groupRepository, Phake::times($numberOfFind))->find(Phake::anyParameters());

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

        $this->assertSame(array('groups_collection' => array()), $this->transformer->transform(null));

Call to method anyParameters from undeclared class \Phake
Open

        Phake::verify($this->groupRepository, Phake::times($numberOfFind))->find(Phake::anyParameters());

Call to method when from undeclared class \Phake
Open

        Phake::when($contextManager)->getAvailableSites()->thenReturn(array());;

Reference to undeclared property \OpenOrchestra\Backoffice\Tests\Form\DataTransformer\GroupListToArrayTransformerTest->transformer
Open

        $this->assertSame(array('groups_collection' => array()), $this->transformer->transform(null));

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

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

Reference to undeclared property \OpenOrchestra\Backoffice\Tests\Form\DataTransformer\GroupListToArrayTransformerTest->transformer
Open

        $this->transformer->reverseTransform($data);

Call to method mock from undeclared class \Phake
Open

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

Call to method __construct from undeclared class \Doctrine\Common\Collections\ArrayCollection
Open

            array(new ArrayCollection(array($group)), array('groups_collection' => array($fakeId=> array('group' => true)))),

Call to method mock from undeclared class \Phake
Open

        $contextManager = Phake::mock('OpenOrchestra\Backoffice\Context\ContextBackOfficeInterface');

Reference to undeclared property \OpenOrchestra\Backoffice\Tests\Form\DataTransformer\GroupListToArrayTransformerTest->transformer
Open

        $result = $this->transformer->reverseTransform($data);

Call to method verify from undeclared class \Phake
Open

        Phake::verify($this->groupRepository, Phake::times($numberOfFind))->find(Phake::anyParameters());

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

class GroupListToArrayTransformerTest extends AbstractBaseTestCase

Reference to undeclared property \OpenOrchestra\Backoffice\Tests\Form\DataTransformer\GroupListToArrayTransformerTest->transformer
Open

        $this->transformer = new GroupListToArrayTransformer($this->groupRepository, $contextManager);

Call to method __construct from undeclared class \Doctrine\Common\Collections\ArrayCollection
Open

            array(new ArrayCollection(array($group, $group)), array('groups_collection' => array($fakeId => array('group' => true)))),

Call to undeclared method \OpenOrchestra\Backoffice\Tests\Form\DataTransformer\GroupListToArrayTransformerTest::assertInstanceOf
Open

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

Reference to undeclared property \OpenOrchestra\Backoffice\Tests\Form\DataTransformer\GroupListToArrayTransformerTest->transformer
Open

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

Call to method mock from undeclared class \Phake
Open

        $this->groupRepository = Phake::mock('OpenOrchestra\GroupBundle\Repository\GroupRepository');

Call to undeclared method \OpenOrchestra\Backoffice\Tests\Form\DataTransformer\GroupListToArrayTransformerTest::assertEquals
Open

        $this->assertEquals(0, count($result));

Call to method when from undeclared class \Phake
Open

        Phake::when($group)->getId()->thenReturn($fakeId);

Avoid excessively long variable names like $suppressSpecialCharacterHelper. Keep variable name length under 20.
Open

    protected $suppressSpecialCharacterHelper;

LongVariable

Since: 0.2

Detects when a field, formal or local variable is declared with a long name.

Example

class Something {
    protected $reallyLongIntName = -3; // VIOLATION - Field
    public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

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

Each PHP statement must be on a line by itself
Open

        Phake::when($contextManager)->getAvailableSites()->thenReturn(array());;

Line exceeds 120 characters; contains 125 characters
Open

            array(new ArrayCollection(array($group)), array('groups_collection' => array($fakeId=> array('group' => true)))),

Line exceeds 120 characters; contains 134 characters
Open

            array(new ArrayCollection(array($group, $group)), array('groups_collection' => array($fakeId => array('group' => true)))),

There are no issues that match your filters.

Category
Status