jaroslavtyc/drd-plus-tables

View on GitHub
tests/Tables/Theurgist/Spells/SpellParameters/RealmsAffectionTest.php

Summary

Maintainability
A
0 mins
Test Coverage

Avoid using static access to class '\DrdPlus\Codes\Theurgist\AffectionPeriodCode' in method 'I_can_create_it_without_period'.
Open

        self::assertSame(AffectionPeriodCode::getIt(AffectionPeriodCode::DAILY), $affection->getAffectionPeriodCode());

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\Codes\Theurgist\AffectionPeriodCode' in method 'I_can_create_it_with_explicit_period'.
Open

        self::assertSame(AffectionPeriodCode::getIt(AffectionPeriodCode::MONTHLY), $affection->getAffectionPeriodCode());

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\Codes\Theurgist\AffectionPeriodCode' in method 'I_can_create_zero_affection'.
Open

        self::assertSame(AffectionPeriodCode::getIt(AffectionPeriodCode::DAILY), $affection->getAffectionPeriodCode());

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_create_it_without_period is not named in camelCase.
Open

    public function I_can_create_it_without_period()
    {
        $affection = new RealmsAffection(['-213']);
        self::assertSame(-213, $affection->getValue());
        self::assertSame('-213 daily', (string)$affection);

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_create_it_with_explicit_period is not named in camelCase.
Open

    public function I_can_create_it_with_explicit_period()
    {
        $affection = new RealmsAffection(['-357', AffectionPeriodCode::MONTHLY]);
        self::assertSame(-357, $affection->getValue());
        self::assertSame('-357 monthly', (string)$affection);

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_not_create_positive_affection is not named in camelCase.
Open

    public function I_can_not_create_positive_affection()
    {
        $this->expectException(\DrdPlus\Tables\Theurgist\Spells\SpellParameters\Exceptions\InvalidFormatForNegativeCastingParameter::class);
        $this->expectExceptionMessageMatches('~1~');
        new RealmsAffection(['1']);

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_create_zero_affection is not named in camelCase.
Open

    public function I_can_create_zero_affection()
    {
        $affection = new RealmsAffection(['0']);
        self::assertSame(0, $affection->getValue());
        self::assertSame('0', (string)$affection);

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