test; } /** * @param \PHPUnit\Framework\Test|null $test */ public function setTest($test): void { $this->test = $test; } /** * Assert that a variable has a given type. * * @param string|string[] $types * List of types, per `gettype()` or `get_class()` * Ex: 'int|string|NULL' * Ex: [`array`, `NULL`, `CRM_Core_DAO`] * @param mixed $value * The variable to check * @param string|null $msg * @see \CRM_Utils_Type::validatePhpType */ public function assertType($types, $value, ?string $msg = NULL) { if (!\CRM_Utils_Type::validatePhpType($value, $types, FALSE)) { $defactoType = is_object($value) ? get_class($value) : gettype($value); $types = is_array($types) ? implode('|', $types) : $types; $this->fail(sprintf("Expected one of (%s) but found %s\n%s", $types, $defactoType, $msg)); } } public function setUp() { } public function tearDown() { } }