Свойство | Type | Description | |
---|---|---|---|
$internal_functions |
Méthode | Description | |
---|---|---|
call ( $callable, $args ) : mixed | Generic method to call a callable, useful for proxying call_user_func* calls | |
callFunction ( $namespace, $func, $params ) | ||
callMethod ( $obj, $class, $method, $args, $check_mock = false ) | ||
callNew ( $class, $args ) | ||
callOriginal ( $callable, $args, $class = null ) | ||
callStaticMethod ( $class, $method, $args, $check_mock = false ) | ||
constDefined ( $const ) | ||
errorHandler ( $errno, $errstr, $errfile, $errline ) | ||
generateCode ( $args, ReflectionMethod | null $Rm ) : string | Generate code that parses function parameters that are specified as string $args | |
getClassConst ( $class, $const ) | ||
getConst ( $namespace, $const ) | ||
getMockCode ( $self, $static, $method ) | ||
getMockForGenerator ( $class, $method ) | ||
ignoreClass ( string $class ) | ||
ignoreConstant ( string $constant ) | ||
ignoreFiles ( $files ) | ||
ignoreFunction ( string $function ) | ||
init ( ) | ||
isCallable ( $callable ) | ||
isGeneratorMocked ( $class, $method ) | ||
isMocked ( $self, $static, $method ) | ||
printBackTrace ( Exception $e = null ) | ||
redefineConstant ( $constantName, $value ) | ||
redefineFunction ( $func, $functionArgs, $fakeCode ) | ||
redefineGenerator ( $class, $method, Generator $replacement ) | ||
redefineMethod ( string $class, string $method, string $functionArgs, string $fakeCode, boolean $strict = true ) | Redefine method $class::$method with args list specified by $functionArgs (args list must be compatible with original function, you can specify only variable names) by using code $fakeCode instead of original function code. | |
redefineNew ( $class, callable $constructorFunc ) | ||
removeConstant ( $constantName ) | ||
replaceFilename ( $file, $raw = false ) | ||
restoreAll ( ) | ||
restoreAllConstants ( ) | ||
restoreAllNew ( ) | ||
restoreConstant ( $constantName ) | ||
restoreFunction ( $func ) | ||
restoreGenerator ( $class, $method ) | ||
restoreMethod ( $class, $method ) | ||
restoreNew ( $class ) | ||
rewrite ( $file ) | ||
setLockFilePath ( $lock_file_path ) | ||
setMocksCachePath ( string $mocks_cache_path ) | ||
setPhpParserPath ( $php_parser_path ) | ||
setPhpunitPath ( string $phpunit_path ) | ||
setRewriteInternal ( boolean $rewrite_internal ) |
Méthode | Description | |
---|---|---|
debug ( $message ) |
Méthode | Description | |
---|---|---|
createRewrittenFile ( $file, $target_file ) | ||
doRewrite ( $file ) | ||
getDeclaringTrait ( $class, $method ) | ||
getVersion ( ) | ||
injectIntoPhpunit ( ) | ||
recursiveGetTraits ( ReflectionClass $Rc ) : ReflectionClass[] | ||
rewriteContents ( $orig_file, $target_file, $contents ) | ||
staticContextIsOk ( $self, $static, $method ) | see \QA\SoftMocks\SoftMocksTest::testParentMismatch to see when getDeclaringClass check is needed |
public static callMethod ( $obj, $class, $method, $args, $check_mock = false ) |
public static callStaticMethod ( $class, $method, $args, $check_mock = false ) |
public static errorHandler ( $errno, $errstr, $errfile, $errline ) |
public static generateCode ( $args, ReflectionMethod | null $Rm ) : string | ||
$args | ||
$Rm | ReflectionMethod | null | |
Résultat | string |
public static ignoreClass ( string $class ) | ||
$class | string | - Do not allow to mock $class |
public static ignoreConstant ( string $constant ) | ||
$constant | string | - Do not allow to mock $constant |
public static ignoreFunction ( string $function ) | ||
$function | string | - Do not allow to mock $function |
public static printBackTrace ( Exception $e = null ) | ||
$e | Exception |
public static redefineFunction ( $func, $functionArgs, $fakeCode ) |
public static redefineGenerator ( $class, $method, Generator $replacement ) | ||
$replacement | Generator |
public static redefineMethod ( string $class, string $method, string $functionArgs, string $fakeCode, boolean $strict = true ) | ||
$class | string | |
$method | string | Method of class to be intercepted |
$functionArgs | string | List of argument names |
$fakeCode | string | Code that will be eval'ed instead of function code |
$strict | boolean | If strict=false then method of declaring class will also be mocked |
public static redefineNew ( $class, callable $constructorFunc ) | ||
$constructorFunc | callable |
public static setLockFilePath ( $lock_file_path ) | ||
$lock_file_path | - Path to lock file that is used when file is rewritten |
public static setMocksCachePath ( string $mocks_cache_path ) | ||
$mocks_cache_path | string | - Path to cache of rewritten files |
public static setPhpParserPath ( $php_parser_path ) | ||
$php_parser_path | - Part of path to PHP Parser so that it can be ignored when rewriting files |
public static setPhpunitPath ( string $phpunit_path ) | ||
$phpunit_path | string | - Part of path to phpunit so that it can be ignored when rewriting files |
public static setRewriteInternal ( boolean $rewrite_internal ) | ||
$rewrite_internal | boolean |