open-orchestra/open-orchestra-cms-bundle

View on GitHub
Backoffice/Tests/Command/OrchestraDeleteSiteToolsTest.php

Summary

Maintainability
A
1 hr
Test Coverage

Method testDisplayUsedReferences has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function testDisplayUsedReferences()
    {
        $content = Phake::mock('OpenOrchestra\ModelInterface\Model\ContentInterface');
        $contentName = 'contentName';
        Phake::when($content)->getName()->thenReturn($contentName);
Severity: Minor
Found in Backoffice/Tests/Command/OrchestraDeleteSiteToolsTest.php - About 1 hr to fix

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

        $this->referenceManager = Phake::mock('OpenOrchestra\Backoffice\Reference\ReferenceManager');

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

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

        $block = Phake::mock('OpenOrchestra\ModelInterface\Model\BlockInterface');

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

        $block = Phake::mock('OpenOrchestra\ModelInterface\Model\BlockInterface');

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

        $content = Phake::mock('OpenOrchestra\ModelInterface\Model\ContentInterface');

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

        $block2 = Phake::mock('OpenOrchestra\ModelInterface\Model\BlockInterface');

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

        Phake::when($this->blockRepository)->findById(Phake::anyParameters())->thenReturn($block);

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->io = Phake::mock('Symfony\Component\Console\Style\SymfonyStyle');

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

        $content = Phake::mock('OpenOrchestra\ModelInterface\Model\ContentInterface');

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->contentRepository = Phake::mock('OpenOrchestra\ModelInterface\Repository\ContentRepositoryInterface');

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->blockRepository = Phake::mock('OpenOrchestra\ModelInterface\Repository\BlockRepositoryInterface');

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

Possibly zero references to use statement for classlike/namespace NodeInterface (\OpenOrchestra\ModelInterface\Model\NodeInterface)
Open

use OpenOrchestra\ModelInterface\Model\NodeInterface;

Call to method mock from undeclared class \Phake
Open

        $content = Phake::mock('OpenOrchestra\ModelInterface\Model\ContentInterface');

Call to method when from undeclared class \Phake
Open

        Phake::when($block)->getId()->thenReturn($blockId);

Call to method mock from undeclared class \Phake
Open

        $block = Phake::mock('OpenOrchestra\ModelInterface\Model\BlockInterface');

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

class OrchestraDeleteSiteToolsTest extends AbstractBaseTestCase

Call to method mock from undeclared class \Phake
Open

        $block = Phake::mock('OpenOrchestra\ModelInterface\Model\BlockInterface');

Call to method when from undeclared class \Phake
Open

        Phake::when($block)->getLabel()->thenReturn($blockLabel);

Call to method verify from undeclared class \Phake
Open

        Phake::verify($this->io)->text('-----------------------------------------------------------');

Call to method when from undeclared class \Phake
Open

        Phake::when($block2)->getSiteId()->thenReturn($siteId);

Call to method verify from undeclared class \Phake
Open

        Phake::verify($this->io)->text('    *  Name: <info>' . $blockLabel . '</info> Language: <info>' . $blockLanguage . '</info> Type <info>' . $blockType . '</info> in site <info>' . $siteId . '</info>');

Call to method mock from undeclared class \Phake
Open

        $this->contentRepository = Phake::mock('OpenOrchestra\ModelInterface\Repository\ContentRepositoryInterface');

Call to method mock from undeclared class \Phake
Open

        $this->blockRepository = Phake::mock('OpenOrchestra\ModelInterface\Repository\BlockRepositoryInterface');

Reference to constant ENTITY_TYPE from undeclared class \OpenOrchestra\ModelInterface\Model\BlockInterface
Open

                BlockInterface::ENTITY_TYPE => array($block, $block2)

Call to method when from undeclared class \Phake
Open

        Phake::when($this->blockRepository)->findById(Phake::anyParameters())->thenReturn($block);

Call to method mock from undeclared class \Phake
Open

        $block2 = Phake::mock('OpenOrchestra\ModelInterface\Model\BlockInterface');

Call to method when from undeclared class \Phake
Open

        Phake::when($block)->getSiteId()->thenReturn('otherSiteId');

Call to method anyParameters from undeclared class \Phake
Open

        Phake::when($this->blockRepository)->findById(Phake::anyParameters())->thenReturn($block);

Call to method verify from undeclared class \Phake
Open

        Phake::verify($this->io)->newLine();

Call to method when from undeclared class \Phake
Open

        Phake::when($block)->getComponent()->thenReturn($blockType);

Call to method verify from undeclared class \Phake
Open

        Phake::verify($this->io)->comment('Entity <info>' . $contentName . ' is used in :');

Call to method mock from undeclared class \Phake
Open

        $this->referenceManager = Phake::mock('OpenOrchestra\Backoffice\Reference\ReferenceManager');

Call to method when from undeclared class \Phake
Open

        Phake::when($block)->getLanguage()->thenReturn($blockLanguage);

Call to method when from undeclared class \Phake
Open

        Phake::when($block)->getSiteId()->thenReturn($siteId);

Call to method when from undeclared class \Phake
Open

        Phake::when($content)->getUseReferences()->thenReturn(

Call to method verify from undeclared class \Phake
Open

        Phake::verify($this->io)->text('    <comment>Blocks:</comment>');

Call to method mock from undeclared class \Phake
Open

        $this->io = Phake::mock('Symfony\Component\Console\Style\SymfonyStyle');

Call to undeclared method \OpenOrchestra\BackOffice\Tests\Command\Strategies\OrchestraDeleteSiteToolsTest::assertEquals
Open

        $this->assertEquals(array(

Call to method when from undeclared class \Phake
Open

        Phake::when($content)->getName()->thenReturn($contentName);

Call to method mock from undeclared class \Phake
Open

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

Call to method mock from undeclared class \Phake
Open

        $content = Phake::mock('OpenOrchestra\ModelInterface\Model\ContentInterface');

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

    protected $io;

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

Line exceeds 120 characters; contains 208 characters
Open

        Phake::verify($this->io)->text('    *  Name: <info>' . $blockLabel . '</info> Language: <info>' . $blockLanguage . '</info> Type <info>' . $blockType . '</info> in site <info>' . $siteId . '</info>');

There are no issues that match your filters.

Category
Status