Backoffice/Tests/Form/DataTransformer/ReferenceToEmbedTransformerTest.php
Avoid using static access to class '\Phake' in method 'setUp'. Open
Open
$entityDbMapper = Phake::mock('OpenOrchestra\ModelInterface\Manager\EntityDbMapperInterface');
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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
Open
$objectManager = Phake::mock('Doctrine\Common\Persistence\ObjectManager');
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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
Open
$this->assertInstanceOf('Symfony\Component\Form\DataTransformerInterface', $this->transformer);
- Create a ticketCreate a ticket
- Exclude checks
Call to method mock
from undeclared class \Phake
Open
Open
$entityDbMapper = Phake::mock('OpenOrchestra\ModelInterface\Manager\EntityDbMapperInterface');
- Create a ticketCreate a ticket
- Exclude checks
Reference to undeclared property \OpenOrchestra\Backoffice\Tests\Form\DataTransformer\ReferenceToEmbedTransformerTest->transformData
Open
Open
$this->assertSame($this->transformData, $this->transformer->transform($this->data));
- Create a ticketCreate a ticket
- Exclude checks
Reference to undeclared property \OpenOrchestra\Backoffice\Tests\Form\DataTransformer\ReferenceToEmbedTransformerTest->transformData
Open
Open
$this->assertSame($this->data, $this->transformer->reverseTransform($this->transformData));
- Create a ticketCreate a ticket
- Exclude checks
Call to method when
from undeclared class \Phake
Open
Open
Phake::when($objectManager)->find($this->documentClass, $this->id)->thenReturn($this->document);
- Create a ticketCreate a ticket
- Exclude checks
Call to method when
from undeclared class \Phake
Open
Open
Phake::when($entityDbMapper)->fromDbToEntity($this->data)->thenReturn($this->document);
- Create a ticketCreate a ticket
- Exclude checks
Call to method when
from undeclared class \Phake
Open
Open
Phake::when($entityDbMapper)->fromEntityToDb($this->document)->thenReturn($this->data);
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\Backoffice\Tests\Form\DataTransformer\ReferenceToEmbedTransformerTest::assertSame
Open
Open
$this->assertSame($this->data, $this->transformer->reverseTransform($this->transformData));
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\Backoffice\Tests\Form\DataTransformer\ReferenceToEmbedTransformerTest::assertSame
Open
Open
$this->assertSame($this->transformData, $this->transformer->transform($this->data));
- Create a ticketCreate a ticket
- Exclude checks
Call to method mock
from undeclared class \Phake
Open
Open
$objectManager = Phake::mock('Doctrine\Common\Persistence\ObjectManager');
- Create a ticketCreate a ticket
- Exclude checks
Class extends undeclared class \OpenOrchestra\BaseBundle\Tests\AbstractTest\AbstractBaseTestCase
Open
Open
class ReferenceToEmbedTransformerTest extends AbstractBaseTestCase
- Create a ticketCreate a ticket
- Exclude checks
Reference to undeclared property \OpenOrchestra\Backoffice\Tests\Form\DataTransformer\ReferenceToEmbedTransformerTest->transformData
Open
Open
$this->transformData = array($this->formTypeName => $this->id);
- Create a ticketCreate a ticket
- Exclude checks
Avoid variables with short names like $id. Configured minimum length is 3. Open
Open
public function __construct($id) {
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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
Open
protected $id = 'fakeId';
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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
Open
protected $id;
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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
Open
class FakeDocument
- Create a ticketCreate a ticket
- Exclude checks
Opening brace should be on a new line Open
Open
public function getId() {
- Create a ticketCreate a ticket
- Exclude checks
Opening brace should be on a new line Open
Open
public function __construct($id) {
- Create a ticketCreate a ticket
- Exclude checks