BaseTestCase - assertHasNoConstructor() method - asserts that class with given namespace has no constructor

This commit is contained in:
Meritoo
2017-09-21 16:47:41 +02:00
parent 6c70fdd673
commit 318a635ffd
14 changed files with 86 additions and 10 deletions

View File

@@ -180,7 +180,7 @@ abstract class BaseTestCase extends TestCase
/**
* Verifies visibility and arguments of class constructor
*
* @param string $classNamespace Namespace of class that contains method to verify
* @param string $classNamespace Namespace of class that contains constructor to verify
* @param string $visibilityType Expected visibility of verified method. One of OopVisibilityType class
* constants.
* @param int $argumentsCount (optional) Expected count/amount of arguments of the verified method
@@ -202,4 +202,20 @@ abstract class BaseTestCase extends TestCase
return $this->verifyMethodVisibilityAndArguments($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
*/
protected static function assertHasNoConstructor($classNamespace)
{
/*
* Let's grab the constructor
*/
$reflection = new ReflectionClass($classNamespace);
$constructor = $reflection->getConstructor();
static::assertNull($constructor);
}
}