gdbots/common-php

View on GitHub
tests/Common/EnumTest.php

Summary

Maintainability
A
0 mins
Test Coverage

Avoid using empty try-catch blocks in testWrongValue.
Open

        } catch (\Exception $e) {
        }
Severity: Minor
Found in tests/Common/EnumTest.php by phpmd

EmptyCatchBlock

Since: 2.7.0

Usually empty try-catch is a bad idea because you are silently swallowing an error condition and then continuing execution. Occasionally this may be the right thing to do, but often it's a sign that a developer saw an exception, didn't know what to do about it, and so used an empty catch to silence the problem.

Example

class Foo {

  public function bar()
  {
      try {
          // ...
      } catch (Exception $e) {} // empty catch block
  }
}

Source https://phpmd.org/rules/design.html#emptycatchblock

Avoid using static access to class 'Gdbots\Tests\Common\TestEnum' in method 'testValues'.
Open

        $enum = TestEnum::CONST1();
Severity: Minor
Found in tests/Common/EnumTest.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 'Gdbots\Tests\Common\TestEnum' in method 'testCreate'.
Open

        $enum = TestEnum::CONST1();
Severity: Minor
Found in tests/Common/EnumTest.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 'Gdbots\Tests\Common\TestEnum' in method 'testWrongValue'.
Open

            TestEnum::create('notvalid');
Severity: Minor
Found in tests/Common/EnumTest.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 'Gdbots\Tests\Common\TestEnum' in method 'testEquals'.
Open

        $enum1 = TestEnum::CONST1();
Severity: Minor
Found in tests/Common/EnumTest.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 'Gdbots\Tests\Common\TestEnum' in method 'testEquals'.
Open

        $enum2 = TestEnum::CONST1();
Severity: Minor
Found in tests/Common/EnumTest.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

Each class must be in a file by itself
Open

class EnumTest extends \PHPUnit_Framework_TestCase
Severity: Minor
Found in tests/Common/EnumTest.php by phpcodesniffer

There are no issues that match your filters.

Category
Status