jaroslavtyc/drd-plus-health

View on GitHub
tests/Health/GridOfWoundsTest.php

Summary

Maintainability
A
2 hrs
Test Coverage

Method I_can_get_calculated_filled_half_rows_for_given_wound_value has 57 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function I_can_get_calculated_filled_half_rows_for_given_wound_value(): void
    {
        // limit of wounds divisible by two (odd)
        $gridOfWounds = new GridOfWounds($this->createHealth([] /* no wounds*/));
        self::assertSame(
Severity: Major
Found in tests/Health/GridOfWoundsTest.php - About 2 hrs to fix

    Avoid using static access to class '\DrdPlus\Health\WoundSize' in method 'I_can_get_calculated_filled_half_rows_for_given_wound_value'.
    Open

                $gridOfWounds->calculateFilledHalfRowsFor(WoundSize::createIt(492), $this->createWoundBoundary(124)),
    Severity: Minor
    Found in tests/Health/GridOfWoundsTest.php by phpmd

    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 '\DrdPlus\Health\WoundSize' in method 'I_can_get_calculated_filled_half_rows_for_given_wound_value'.
    Open

                $gridOfWounds->calculateFilledHalfRowsFor(WoundSize::createIt(0), $this->createWoundBoundary(124)),
    Severity: Minor
    Found in tests/Health/GridOfWoundsTest.php by phpmd

    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 '\DrdPlus\Health\WoundSize' in method 'I_can_get_calculated_filled_half_rows_for_given_wound_value'.
    Open

                $gridOfWounds->calculateFilledHalfRowsFor(WoundSize::createIt(11), $this->createWoundBoundary(22)),
    Severity: Minor
    Found in tests/Health/GridOfWoundsTest.php by phpmd

    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 '\DrdPlus\Health\WoundSize' in method 'I_can_get_calculated_filled_half_rows_for_given_wound_value'.
    Open

                $gridOfWounds->calculateFilledHalfRowsFor(WoundSize::createIt(999), $this->createWoundBoundary(111)),
    Severity: Minor
    Found in tests/Health/GridOfWoundsTest.php by phpmd

    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 '\DrdPlus\Health\WoundSize' in method 'I_can_get_calculated_filled_half_rows_for_given_wound_value'.
    Open

                $gridOfWounds->calculateFilledHalfRowsFor(WoundSize::createIt(5), $this->createWoundBoundary(333)),
    Severity: Minor
    Found in tests/Health/GridOfWoundsTest.php by phpmd

    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 '\DrdPlus\Health\WoundSize' in method 'I_can_get_calculated_filled_half_rows_for_given_wound_value'.
    Open

                $gridOfWounds->calculateFilledHalfRowsFor(WoundSize::createIt(10), $this->createWoundBoundary(4)),
    Severity: Minor
    Found in tests/Health/GridOfWoundsTest.php by phpmd

    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 '\DrdPlus\Health\WoundSize' in method 'I_can_get_calculated_filled_half_rows_for_given_wound_value'.
    Open

                $gridOfWounds->calculateFilledHalfRowsFor(WoundSize::createIt(6), $this->createWoundBoundary(13)),
    Severity: Minor
    Found in tests/Health/GridOfWoundsTest.php by phpmd

    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 '\DrdPlus\Health\WoundSize' in method 'I_can_get_calculated_filled_half_rows_for_given_wound_value'.
    Open

                $gridOfWounds->calculateFilledHalfRowsFor(WoundSize::createIt(10), $this->createWoundBoundary(5))
    Severity: Minor
    Found in tests/Health/GridOfWoundsTest.php by phpmd

    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 '\DrdPlus\Health\WoundSize' in method 'I_can_get_calculated_filled_half_rows_for_given_wound_value'.
    Open

                $gridOfWounds->calculateFilledHalfRowsFor(WoundSize::createIt(13), $this->createWoundBoundary(13)),
    Severity: Minor
    Found in tests/Health/GridOfWoundsTest.php by phpmd

    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 '\DrdPlus\Health\WoundSize' in method 'I_can_get_calculated_filled_half_rows_for_given_wound_value'.
    Open

                $gridOfWounds->calculateFilledHalfRowsFor(WoundSize::createIt(7), $this->createWoundBoundary(5)),
    Severity: Minor
    Found in tests/Health/GridOfWoundsTest.php by phpmd

    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 '\DrdPlus\Health\WoundSize' in method 'I_can_get_calculated_filled_half_rows_for_given_wound_value'.
    Open

                $gridOfWounds->calculateFilledHalfRowsFor(WoundSize::createIt(8), $this->createWoundBoundary(5))
    Severity: Minor
    Found in tests/Health/GridOfWoundsTest.php by phpmd

    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 '\DrdPlus\Health\WoundSize' in method 'I_can_get_calculated_filled_half_rows_for_given_wound_value'.
    Open

                $gridOfWounds->calculateFilledHalfRowsFor(WoundSize::createIt(7), $this->createWoundBoundary(13))
    Severity: Minor
    Found in tests/Health/GridOfWoundsTest.php by phpmd

    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

    The method I_can_get_calculated_filled_half_rows_for_given_wound_value is not named in camelCase.
    Open

        public function I_can_get_calculated_filled_half_rows_for_given_wound_value(): void
        {
            // limit of wounds divisible by two (odd)
            $gridOfWounds = new GridOfWounds($this->createHealth([] /* no wounds*/));
            self::assertSame(
    Severity: Minor
    Found in tests/Health/GridOfWoundsTest.php by phpmd

    CamelCaseMethodName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name methods.

    Example

    class ClassName {
        public function get_name() {
        }
    }

    Source

    The method I_can_get_maximum_of_wounds_per_row is not named in camelCase.
    Open

        public function I_can_get_maximum_of_wounds_per_row(): void
        {
            $gridOfWounds = new GridOfWounds($this->createHealth([] /* no wounds*/));
            self::assertSame(123, $gridOfWounds->getWoundsPerRowMaximum($this->createWoundBoundary(123)));
        }
    Severity: Minor
    Found in tests/Health/GridOfWoundsTest.php by phpmd

    CamelCaseMethodName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name methods.

    Example

    class ClassName {
        public function get_name() {
        }
    }

    Source

    The method I_can_get_number_of_filled_rows is not named in camelCase.
    Open

        public function I_can_get_number_of_filled_rows(): void
        {
            $gridOfWounds = new GridOfWounds($this->createHealth($this->createWounds([3, 1])));
            self::assertSame(
                0,
    Severity: Minor
    Found in tests/Health/GridOfWoundsTest.php by phpmd

    CamelCaseMethodName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name methods.

    Example

    class ClassName {
        public function get_name() {
        }
    }

    Source

    There are no issues that match your filters.

    Category
    Status