diff --git a/src/Traits/Test/Base/BaseTestCaseTrait.php b/src/Traits/Test/Base/BaseTestCaseTrait.php index 7c4caea..74eea20 100644 --- a/src/Traits/Test/Base/BaseTestCaseTrait.php +++ b/src/Traits/Test/Base/BaseTestCaseTrait.php @@ -14,7 +14,6 @@ use Meritoo\Common\Exception\Type\UnknownOopVisibilityTypeException; use Meritoo\Common\Type\OopVisibilityType; use Meritoo\Common\Utilities\Miscellaneous; use ReflectionClass; -use ReflectionException; use ReflectionMethod; use stdClass; @@ -172,7 +171,6 @@ trait BaseTestCaseTrait * @param int $requiredArgumentsCount (optional) Expected count/amount of required arguments * of the verified method * @throws UnknownOopVisibilityTypeException - * @throws ReflectionException * * Attention. 2nd argument, the $method, may be: * - string - name of the method @@ -229,8 +227,6 @@ trait BaseTestCaseTrait * @param int $argumentsCount (optional) Expected count/amount of arguments of the verified method * @param int $requiredArgumentsCount (optional) Expected count/amount of required arguments of the verified * method - * @throws ReflectionException - * @throws UnknownOopVisibilityTypeException */ protected static function assertConstructorVisibilityAndArguments( $classNamespace, @@ -244,14 +240,19 @@ trait BaseTestCaseTrait $reflection = new ReflectionClass($classNamespace); $method = $reflection->getConstructor(); - static::assertMethodVisibilityAndArguments($classNamespace, $method, $visibilityType, $argumentsCount, $requiredArgumentsCount); + static::assertMethodVisibilityAndArguments( + $classNamespace, + $method, + $visibilityType, + $argumentsCount, + $requiredArgumentsCount + ); } /** * Asserts that class with given namespace has no constructor * * @param string $classNamespace Namespace of class that contains constructor to verify - * @throws ReflectionException */ protected static function assertHasNoConstructor($classNamespace) { diff --git a/tests/Utilities/ReflectionTest.php b/tests/Utilities/ReflectionTest.php index 3a178a6..660da65 100644 --- a/tests/Utilities/ReflectionTest.php +++ b/tests/Utilities/ReflectionTest.php @@ -82,8 +82,15 @@ class ReflectionTest extends BaseTestCase * Class with namespace containing name of class (duplicated string) */ if (class_exists('Symfony\Bundle\SecurityBundle\SecurityBundle')) { - self::assertEquals('Symfony\Bundle\SecurityBundle\SecurityBundle', Reflection::getClassName('Symfony\Bundle\SecurityBundle\SecurityBundle')); - self::assertEquals('SecurityBundle', Reflection::getClassName('Symfony\Bundle\SecurityBundle\SecurityBundle', true)); + self::assertEquals( + 'Symfony\Bundle\SecurityBundle\SecurityBundle', + Reflection::getClassName('Symfony\Bundle\SecurityBundle\SecurityBundle') + ); + + self::assertEquals( + 'SecurityBundle', + Reflection::getClassName('Symfony\Bundle\SecurityBundle\SecurityBundle', true) + ); } } @@ -115,7 +122,10 @@ class ReflectionTest extends BaseTestCase * Class with namespace containing name of class (duplicated string) */ if (class_exists('Symfony\Bundle\SecurityBundle\SecurityBundle')) { - self::assertEquals('Symfony\Bundle\SecurityBundle', Reflection::getClassNamespace('Symfony\Bundle\SecurityBundle\SecurityBundle')); + self::assertEquals( + 'Symfony\Bundle\SecurityBundle', + Reflection::getClassNamespace('Symfony\Bundle\SecurityBundle\SecurityBundle') + ); } } @@ -183,11 +193,11 @@ class ReflectionTest extends BaseTestCase public function testGetMethods() { - self::assertEquals(1, count(Reflection::getMethods(B::class, true))); - self::assertEquals(3, count(Reflection::getMethods(B::class))); - self::assertEquals(2, count(Reflection::getMethods(A::class))); - self::assertEquals(2, count(Reflection::getMethods(C::class, true))); - self::assertEquals(5, count(Reflection::getMethods(C::class))); + self::assertCount(1, Reflection::getMethods(B::class, true)); + self::assertCount(3, Reflection::getMethods(B::class)); + self::assertCount(2, Reflection::getMethods(A::class)); + self::assertCount(2, Reflection::getMethods(C::class, true)); + self::assertCount(5, Reflection::getMethods(C::class)); } /** @@ -235,9 +245,20 @@ class ReflectionTest extends BaseTestCase public function testGetPropertiesUsingFilter() { - self::assertCount(1, Reflection::getProperties(B::class, ReflectionProperty::IS_PROTECTED)); - self::assertCount(0, Reflection::getProperties(B::class, ReflectionProperty::IS_PRIVATE)); - self::assertCount(1, Reflection::getProperties(B::class, ReflectionProperty::IS_PRIVATE, true)); + self::assertCount( + 1, + Reflection::getProperties(B::class, ReflectionProperty::IS_PROTECTED) + ); + + self::assertCount( + 0, + Reflection::getProperties(B::class, ReflectionProperty::IS_PRIVATE) + ); + + self::assertCount( + 1, + Reflection::getProperties(B::class, ReflectionProperty::IS_PRIVATE, true) + ); } public function testGetPropertiesWithParents()