mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-08 01:15:37 +08:00
V3 fix/phpunit (#1024)
This commit is contained in:
@@ -7,6 +7,7 @@ namespace Tests\StaticPHP\DI;
|
||||
use DI\Container;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use StaticPHP\DI\CallbackInvoker;
|
||||
use StaticPHP\Exception\SPCInternalException;
|
||||
|
||||
/**
|
||||
* Helper class that requires constructor parameters for testing
|
||||
@@ -92,7 +93,7 @@ class CallbackInvokerTest extends TestCase
|
||||
|
||||
// Should not resolve from container as 'test.service' is not a type
|
||||
// Will try default value or null
|
||||
$this->expectException(\RuntimeException::class);
|
||||
$this->expectException(SPCInternalException::class);
|
||||
$this->invoker->invoke($callback);
|
||||
}
|
||||
|
||||
@@ -139,7 +140,7 @@ class CallbackInvokerTest extends TestCase
|
||||
return $required;
|
||||
};
|
||||
|
||||
$this->expectException(\RuntimeException::class);
|
||||
$this->expectException(SPCInternalException::class);
|
||||
$this->expectExceptionMessage("Cannot resolve parameter 'required' of type 'string'");
|
||||
$this->invoker->invoke($callback);
|
||||
}
|
||||
@@ -527,7 +528,7 @@ class CallbackInvokerTest extends TestCase
|
||||
$callback = eval('return function (string|int $param) { return $param; };');
|
||||
|
||||
// Union types are not ReflectionNamedType, should not be resolved from container
|
||||
$this->expectException(\RuntimeException::class);
|
||||
$this->expectException(SPCInternalException::class);
|
||||
$this->invoker->invoke($callback);
|
||||
}
|
||||
|
||||
@@ -594,7 +595,7 @@ class CallbackInvokerTest extends TestCase
|
||||
return $obj;
|
||||
};
|
||||
|
||||
$this->expectException(\RuntimeException::class);
|
||||
$this->expectException(SPCInternalException::class);
|
||||
$this->expectExceptionMessage("Cannot resolve parameter 'obj'");
|
||||
|
||||
$this->invoker->invoke($callback);
|
||||
|
||||
Reference in New Issue
Block a user