2017-09-19 20:06:16 +03:00
|
|
|
<?php
|
|
|
|
declare(strict_types=1);
|
2019-02-20 22:58:52 +03:00
|
|
|
namespace common\tests\helpers;
|
2017-09-19 20:06:16 +03:00
|
|
|
|
|
|
|
use phpmock\mockery\PHPMockery;
|
|
|
|
use ReflectionClass;
|
|
|
|
|
|
|
|
class Mock {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param string $className
|
|
|
|
* @param string $function
|
|
|
|
*
|
|
|
|
* @return \Mockery\Expectation
|
|
|
|
*/
|
|
|
|
public static function func(string $className, string $function) {
|
|
|
|
return PHPMockery::mock(self::getClassNamespace($className), $function);
|
|
|
|
}
|
|
|
|
|
|
|
|
private static function getClassNamespace(string $className): string {
|
|
|
|
return (new ReflectionClass($className))->getNamespaceName();
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|