eugene-matvejev/battleship-game-api

View on GitHub
tests/phpunit/GameBundle/Service/AI/AIStrategyProcessorTest.php

Summary

Maintainability
A
1 hr
Test Coverage

Method processPathsComplete has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function processPathsComplete()
    {
        $battlefield = MockFactory::getBattlefieldMock();
        $battlefield->getCellByCoordinate('B2')->setFlags(CellModel::FLAG_DEAD_SHIP);

Severity: Minor
Found in tests/phpunit/GameBundle/Service/AI/AIStrategyProcessorTest.php - About 1 hr to fix

    Avoid using static access to class '\EM\Tests\Environment\Factory\MockFactory' in method 'processPathExpectedExceptionOnNotExistingCell'.
    Open

            $battlefield = MockFactory::getBattlefieldMock();

    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 '\EM\Tests\Environment\Factory\MockFactory' in method 'processPathOnValidCell'.
    Open

            $battlefield = MockFactory::getBattlefieldMock();

    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 '\EM\Tests\Environment\Factory\MockFactory' in method 'processPathExpectedExceptionOnDeadNonShipCell'.
    Open

            $battlefield = MockFactory::getBattlefieldMock();

    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 '\EM\Tests\Environment\Factory\MockFactory' in method 'processPathOnValidDeadShipCell'.
    Open

            $battlefield = MockFactory::getBattlefieldMock();

    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 '\EM\Tests\Environment\Factory\MockFactory' in method 'processPathsComplete'.
    Open

            $battlefield = MockFactory::getBattlefieldMock();

    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

    Line exceeds 120 characters; contains 126 characters
    Open

            $cells = static::$strategyProcessor->process(MockFactory::getBattlefieldMock()->getCellByCoordinate('B2'), $strategy);

    There are no issues that match your filters.

    Category
    Status