Backoffice/Tests/Form/DataTransformer/ChoicesOptionToArrayTransformerTest.php
Avoid using static access to class '\Phake' in method 'setUp'. Open
Open
$this->suppressSpecialCharacterHelper = Phake::mock('OpenOrchestra\ModelInterface\Helper\SuppressSpecialCharacterHelperInterface');
- 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\ChoicesOptionToArrayTransformerTest::assertSame
Open
Open
$this->assertSame($transformData, $this->transformer->transform($data));
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\Backoffice\Tests\Form\DataTransformer\ChoicesOptionToArrayTransformerTest::assertInstanceOf
Open
Open
$this->assertInstanceOf('Symfony\Component\Form\DataTransformerInterface', $this->transformer);
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\Backoffice\Tests\Form\DataTransformer\ChoicesOptionToArrayTransformerTest::assertSame
Open
Open
$this->assertSame(null, $this->transformer->reverseTransform($data));
- Create a ticketCreate a ticket
- Exclude checks
Call to method when
from undeclared class \Phake
Open
Open
Phake::when($this->suppressSpecialCharacterHelper)->transform('choice2', array('_','.'))->thenReturn('choice2');
- Create a ticketCreate a ticket
- Exclude checks
Call to method when
from undeclared class \Phake
Open
Open
Phake::when($this->suppressSpecialCharacterHelper)->transform('translate.choice_1', array('_','.'))->thenReturn('translate.choice_1');
- Create a ticketCreate a ticket
- Exclude checks
Call to method when
from undeclared class \Phake
Open
Open
Phake::when($this->suppressSpecialCharacterHelper)->transform('translate.choîce@=!_2', array('_','.'))->thenReturn('translate.choice_2');
- Create a ticketCreate a ticket
- Exclude checks
Call to method mock
from undeclared class \Phake
Open
Open
$this->suppressSpecialCharacterHelper = Phake::mock('OpenOrchestra\ModelInterface\Helper\SuppressSpecialCharacterHelperInterface');
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\Backoffice\Tests\Form\DataTransformer\ChoicesOptionToArrayTransformerTest::assertSame
Open
Open
$this->assertSame($transformData, $this->transformer->reverseTransform($data));
- Create a ticketCreate a ticket
- Exclude checks
Class extends undeclared class \OpenOrchestra\BaseBundle\Tests\AbstractTest\AbstractBaseTestCase
Open
Open
class ChoicesOptionToArrayTransformerTest extends AbstractBaseTestCase
- Create a ticketCreate a ticket
- Exclude checks
Argument 1 (arrayChoices)
is null
but \OpenOrchestra\Backoffice\Form\DataTransformer\ChoicesOptionToArrayTransformer::transform()
takes array
defined at /code/Backoffice/Form/DataTransformer/ChoicesOptionToArrayTransformer.php:28
Open
Open
$this->assertSame('', $this->transformer->transform(null));
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\Backoffice\Tests\Form\DataTransformer\ChoicesOptionToArrayTransformerTest::assertSame
Open
Open
$this->assertSame('', $this->transformer->transform(null));
- Create a ticketCreate a ticket
- Exclude checks
Call to method when
from undeclared class \Phake
Open
Open
Phake::when($this->suppressSpecialCharacterHelper)->transform('choice', array('_','.'))->thenReturn('choice');
- Create a ticketCreate a ticket
- Exclude checks
Call to method when
from undeclared class \Phake
Open
Open
Phake::when($this->suppressSpecialCharacterHelper)->transform('choîce@=!', array('_','.'))->thenReturn('choice');
- Create a ticketCreate a ticket
- Exclude checks
Call to method when
from undeclared class \Phake
Open
Open
Phake::when($this->suppressSpecialCharacterHelper)->transform('', array('_','.'))->thenReturn('');
- Create a ticketCreate a ticket
- Exclude checks
Avoid excessively long variable names like $suppressSpecialCharacterHelper. Keep variable name length under 20. Open
Open
protected $suppressSpecialCharacterHelper;
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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
Line exceeds 120 characters; contains 142 characters Open
Open
Phake::when($this->suppressSpecialCharacterHelper)->transform('translate.choice_1', array('_','.'))->thenReturn('translate.choice_1');
- Create a ticketCreate a ticket
- Exclude checks
Line exceeds 120 characters; contains 122 characters Open
Open
Phake::when($this->suppressSpecialCharacterHelper)->transform('choîce@=!', array('_','.'))->thenReturn('choice');
- Create a ticketCreate a ticket
- Exclude checks
Line exceeds 120 characters; contains 146 characters Open
Open
Phake::when($this->suppressSpecialCharacterHelper)->transform('translate.choîce@=!_2', array('_','.'))->thenReturn('translate.choice_2');
- Create a ticketCreate a ticket
- Exclude checks
Line exceeds 120 characters; contains 139 characters Open
Open
$this->suppressSpecialCharacterHelper = Phake::mock('OpenOrchestra\ModelInterface\Helper\SuppressSpecialCharacterHelperInterface');
- Create a ticketCreate a ticket
- Exclude checks
Opening brace should be on a new line Open
Open
public function testReverseTransformWithStringData($data, $transformData){
- Create a ticketCreate a ticket
- Exclude checks