open-orchestra/open-orchestra-cms-bundle

View on GitHub
Backoffice/Tests/Validator/Constraints/CheckMainAliasPresenceValidatorTest.php

Summary

Maintainability
A
0 mins
Test Coverage

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

        Phake::when($this->constraintViolationBuilder)->atPath(Phake::anyParameters())->thenReturn($this->constraintViolationBuilder);

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->context)->buildViolation(Phake::anyParameters())->thenReturn($this->constraintViolationBuilder);

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

        Phake::verify($this->constraintViolationBuilder, Phake::times($violationTimes));

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->site = Phake::mock('OpenOrchestra\ModelInterface\Model\SiteInterface');

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->constraintViolationBuilder = Phake::mock('Symfony\Component\Validator\Violation\ConstraintViolationBuilderInterface');

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

            array(array(Phake::mock('OpenOrchestra\ModelInterface\Model\SiteAliasInterface')), 0),

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

        Phake::verify($this->constraintViolationBuilder, Phake::times($violationTimes));

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->constraint = Phake::mock('Symfony\Component\Validator\Constraint');

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->context = Phake::mock('Symfony\Component\Validator\Context\ExecutionContextInterface');

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 anyParameters from undeclared class \Phake
Open

        Phake::when($this->constraintViolationBuilder)->atPath(Phake::anyParameters())->thenReturn($this->constraintViolationBuilder);

Call to method times from undeclared class \Phake
Open

        Phake::verify($this->constraintViolationBuilder, Phake::times($violationTimes));

Call to method mock from undeclared class \Phake
Open

        $this->constraintViolationBuilder = Phake::mock('Symfony\Component\Validator\Violation\ConstraintViolationBuilderInterface');

Call to method mock from undeclared class \Phake
Open

        $this->constraint = Phake::mock('Symfony\Component\Validator\Constraint');

Call to method when from undeclared class \Phake
Open

        Phake::when($this->constraintViolationBuilder)->atPath(Phake::anyParameters())->thenReturn($this->constraintViolationBuilder);

Call to method mock from undeclared class \Phake
Open

        $this->context = Phake::mock('Symfony\Component\Validator\Context\ExecutionContextInterface');

Call to method anyParameters from undeclared class \Phake
Open

        Phake::when($this->context)->buildViolation(Phake::anyParameters())->thenReturn($this->constraintViolationBuilder);

Call to undeclared method \OpenOrchestra\Backoffice\Tests\Validator\Constraints\CheckMainAliasPresenceValidatorTest::assertInstanceOf
Open

        $this->assertInstanceOf('Symfony\Component\Validator\ConstraintValidator', $this->validator);

Call to method verify from undeclared class \Phake
Open

        Phake::verify($this->constraintViolationBuilder, Phake::times($violationTimes));

Call to method mock from undeclared class \Phake
Open

            array(array(Phake::mock('OpenOrchestra\ModelInterface\Model\SiteAliasInterface')), 0),

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

class CheckMainAliasPresenceValidatorTest extends AbstractBaseTestCase

Call to method mock from undeclared class \Phake
Open

        $this->site = Phake::mock('OpenOrchestra\ModelInterface\Model\SiteInterface');

Call to method when from undeclared class \Phake
Open

        Phake::when($this->context)->buildViolation(Phake::anyParameters())->thenReturn($this->constraintViolationBuilder);

Call to undeclared method \OpenOrchestra\Backoffice\Validator\Constraints\CheckMainAliasPresenceValidator::initialize
Open

        $this->validator->initialize($this->context);

Call to method when from undeclared class \Phake
Open

        Phake::when($this->site)->getAliases()->thenReturn($aliases);

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

    protected $constraintViolationBuilder;

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

        Phake::when($this->context)->buildViolation(Phake::anyParameters())->thenReturn($this->constraintViolationBuilder);

Line exceeds 120 characters; contains 134 characters
Open

        Phake::when($this->constraintViolationBuilder)->atPath(Phake::anyParameters())->thenReturn($this->constraintViolationBuilder);

Line exceeds 120 characters; contains 133 characters
Open

        $this->constraintViolationBuilder = Phake::mock('Symfony\Component\Validator\Violation\ConstraintViolationBuilderInterface');

There are no issues that match your filters.

Category
Status