Do not require name of class by BaseTestCaseTrait::assertMethodVisibilityAndArguments() method

This commit is contained in:
Meritoo
2019-06-17 08:43:40 +02:00
parent c4e09f77a3
commit 3b81d0d932
3 changed files with 1 additions and 12 deletions

View File

@@ -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

View File

@@ -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,

View File

@@ -332,7 +332,6 @@ class CollectionTest extends BaseTestCase
$method = $reflectionClass->getMethod('exists');
static::assertMethodVisibilityAndArguments(
Collection::class,
$method,
OopVisibilityType::IS_PRIVATE,
1,