mirror of
https://github.com/zhamao-robot/zhamao-framework.git
synced 2026-07-02 14:25:38 +08:00
add proxy server command and update lowest version of PHP >= 8.0
This commit is contained in:
@@ -4,13 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace Tests\ZM\Utils;
|
||||
|
||||
use Closure;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use ReflectionClass;
|
||||
use ReflectionFunction;
|
||||
use ReflectionFunctionAbstract;
|
||||
use ReflectionMethod;
|
||||
use stdClass;
|
||||
use ZM\Utils\ReflectionUtil;
|
||||
|
||||
/**
|
||||
@@ -30,7 +24,7 @@ class ReflectionUtilTest extends TestCase
|
||||
|
||||
public function testGetParameterClassName(): void
|
||||
{
|
||||
$class = new ReflectionClass(ReflectionUtilTestClass::class);
|
||||
$class = new \ReflectionClass(ReflectionUtilTestClass::class);
|
||||
$method = $class->getMethod('method');
|
||||
[$string_parameter, $object_parameter] = $method->getParameters();
|
||||
|
||||
@@ -52,10 +46,10 @@ class ReflectionUtilTest extends TestCase
|
||||
return [
|
||||
'callable' => [[new ReflectionUtilTestClass(), 'method'], ReflectionUtilTestClass::class . '@method'],
|
||||
'static callable' => [[ReflectionUtilTestClass::class, 'staticMethod'], ReflectionUtilTestClass::class . '::staticMethod'],
|
||||
'closure' => [Closure::fromCallable([$this, 'testVariableToString']), 'closure'],
|
||||
'closure' => [\Closure::fromCallable([$this, 'testVariableToString']), 'closure'],
|
||||
'string' => ['string', 'string'],
|
||||
'array' => [['123', '42', 'hello', 122], 'array["123","42","hello",122]'],
|
||||
'object' => [new stdClass(), 'stdClass'],
|
||||
'object' => [new \stdClass(), 'stdClass'],
|
||||
'resource' => [fopen('php://memory', 'rb'), 'resource(stream)'],
|
||||
'null' => [null, 'null'],
|
||||
'boolean 1' => [true, 'true'],
|
||||
@@ -69,7 +63,7 @@ class ReflectionUtilTest extends TestCase
|
||||
* @dataProvider provideTestGetCallReflector
|
||||
* @param mixed $callback
|
||||
*/
|
||||
public function testGetCallReflector($callback, ReflectionFunctionAbstract $expected): void
|
||||
public function testGetCallReflector($callback, \ReflectionFunctionAbstract $expected): void
|
||||
{
|
||||
$this->assertEquals($expected, ReflectionUtil::getCallReflector($callback));
|
||||
}
|
||||
@@ -80,11 +74,11 @@ class ReflectionUtilTest extends TestCase
|
||||
};
|
||||
|
||||
return [
|
||||
'callable' => [[new ReflectionUtilTestClass(), 'method'], new ReflectionMethod(ReflectionUtilTestClass::class, 'method')],
|
||||
'static callable' => [[ReflectionUtilTestClass::class, 'staticMethod'], new ReflectionMethod(ReflectionUtilTestClass::class, 'staticMethod')],
|
||||
'class::method' => [ReflectionUtilTestClass::class . '::staticMethod', new ReflectionMethod(ReflectionUtilTestClass::class, 'staticMethod')],
|
||||
'invokable class' => [new InvokableClass(), new ReflectionMethod(InvokableClass::class, '__invoke')],
|
||||
'closure' => [$closure, new ReflectionFunction($closure)],
|
||||
'callable' => [[new ReflectionUtilTestClass(), 'method'], new \ReflectionMethod(ReflectionUtilTestClass::class, 'method')],
|
||||
'static callable' => [[ReflectionUtilTestClass::class, 'staticMethod'], new \ReflectionMethod(ReflectionUtilTestClass::class, 'staticMethod')],
|
||||
'class::method' => [ReflectionUtilTestClass::class . '::staticMethod', new \ReflectionMethod(ReflectionUtilTestClass::class, 'staticMethod')],
|
||||
'invokable class' => [new InvokableClass(), new \ReflectionMethod(InvokableClass::class, '__invoke')],
|
||||
'closure' => [$closure, new \ReflectionFunction($closure)],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@ use PHPUnit\Runner\BaseTestRunner;
|
||||
use PHPUnit\Runner\PhptTestCase;
|
||||
use PHPUnit\Util\Color;
|
||||
use PHPUnit\Util\TestDox\CliTestDoxPrinter;
|
||||
use Throwable;
|
||||
|
||||
class ZMResultPrinter extends CliTestDoxPrinter
|
||||
{
|
||||
@@ -164,7 +163,7 @@ class ZMResultPrinter extends CliTestDoxPrinter
|
||||
}
|
||||
}
|
||||
|
||||
protected function formatTestResultMessage(Throwable $t, array $result, ?string $prefix = null): string
|
||||
protected function formatTestResultMessage(\Throwable $t, array $result, ?string $prefix = null): string
|
||||
{
|
||||
$message = $this->formatThrowable($t, $result['status']);
|
||||
$diff = '';
|
||||
|
||||
Reference in New Issue
Block a user