mirror of
https://github.com/wiosna-dev/common-library.git
synced 2026-03-12 01:31:45 +01:00
Do not require name of class by BaseTestCaseTrait::assertMethodVisibilityAndArguments() method
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -332,7 +332,6 @@ class CollectionTest extends BaseTestCase
|
||||
$method = $reflectionClass->getMethod('exists');
|
||||
|
||||
static::assertMethodVisibilityAndArguments(
|
||||
Collection::class,
|
||||
$method,
|
||||
OopVisibilityType::IS_PRIVATE,
|
||||
1,
|
||||
|
||||
Reference in New Issue
Block a user