diff --git a/CHANGELOG.md b/CHANGELOG.md index 09f9de7..c694dcf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ Common and useful classes, methods, exceptions etc. 1. Use `.env` instead of `.env.dist` 2. Docker > use images (instead of Dockerfiles) 3. composer > squizlabs/php_codesniffer package > use ^3.4 (instead of ^2.9) +4. Do not require name of class by BaseTestCaseTrait::assertMethodVisibilityAndArguments() method # 1.0.5 diff --git a/src/Traits/Test/Base/BaseTestCaseTrait.php b/src/Traits/Test/Base/BaseTestCaseTrait.php index 504922d..554291f 100644 --- a/src/Traits/Test/Base/BaseTestCaseTrait.php +++ b/src/Traits/Test/Base/BaseTestCaseTrait.php @@ -164,7 +164,6 @@ trait BaseTestCaseTrait /** * Verifies visibility and arguments of method * - * @param string $className Fully-qualified name of class that contains method to verify * @param ReflectionMethod $method Name of method or just the method to verify * @param string $visibilityType Expected visibility of verified method. One of OopVisibilityType * class constants. @@ -180,7 +179,6 @@ trait BaseTestCaseTrait * - instance of ReflectionMethod - just the method (provided by ReflectionClass::getMethod() method) */ protected static function assertMethodVisibilityAndArguments( - string $className, ReflectionMethod $method, string $visibilityType, int $argumentsCount = 0, @@ -191,14 +189,6 @@ trait BaseTestCaseTrait throw UnknownOopVisibilityTypeException::createException($visibilityType); } - $reflection = new ReflectionClass($className); - - // Name of method provided only? - // Let's find instance of the method (based on reflection) - if (!$method instanceof ReflectionMethod) { - $method = $reflection->getMethod($method); - } - switch ($visibilityType) { case OopVisibilityType::IS_PUBLIC: static::assertTrue($method->isPublic()); @@ -243,7 +233,6 @@ trait BaseTestCaseTrait } static::assertMethodVisibilityAndArguments( - $className, $method, $visibilityType, $argumentsCount, diff --git a/tests/Collection/CollectionTest.php b/tests/Collection/CollectionTest.php index 1b0bef1..96e61ab 100644 --- a/tests/Collection/CollectionTest.php +++ b/tests/Collection/CollectionTest.php @@ -332,7 +332,6 @@ class CollectionTest extends BaseTestCase $method = $reflectionClass->getMethod('exists'); static::assertMethodVisibilityAndArguments( - Collection::class, $method, OopVisibilityType::IS_PRIVATE, 1,