mirror of
https://github.com/zhamao-robot/zhamao-framework.git
synced 2026-07-25 01:25:34 +08:00
fix ZMRequestTest wrong assertion
This commit is contained in:
@@ -58,20 +58,22 @@ class ZMConfig
|
|||||||
*/
|
*/
|
||||||
private ?ConfigTracer $tracer = null;
|
private ?ConfigTracer $tracer = null;
|
||||||
|
|
||||||
/** @var LoaderInterface 配置加载器 */
|
/**
|
||||||
|
* @var LoaderInterface 配置加载器
|
||||||
|
* @phpstan-ignore-next-line We will use this property in the future.
|
||||||
|
*/
|
||||||
private LoaderInterface $loader;
|
private LoaderInterface $loader;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 构造配置实例
|
* 构造配置实例
|
||||||
*
|
*
|
||||||
* @param array $config_paths 配置文件路径
|
* @param string $environment 环境
|
||||||
* @param string $environment 环境
|
|
||||||
*
|
*
|
||||||
* @throws ConfigException 配置文件加载出错
|
* @throws ConfigException 配置文件加载出错
|
||||||
*/
|
*/
|
||||||
public function __construct(string $environment = 'uninitiated')
|
public function __construct(string $environment = 'uninitiated', array $init_config = null)
|
||||||
{
|
{
|
||||||
$conf = $this->loadInitConfig();
|
$conf = $init_config ?: $this->loadInitConfig();
|
||||||
$this->file_extensions = $conf['source']['extensions'];
|
$this->file_extensions = $conf['source']['extensions'];
|
||||||
$this->config_paths = $conf['source']['paths'];
|
$this->config_paths = $conf['source']['paths'];
|
||||||
|
|
||||||
|
|||||||
@@ -56,9 +56,9 @@ class ZMConfigTest extends TestCase
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$config = new ZMConfig([
|
$init_conf = require SOURCE_ROOT_DIR . '/config/config.php';
|
||||||
$this->vfs->url(),
|
$init_conf['source']['paths'] = [$this->vfs->url()];
|
||||||
], 'development');
|
$config = new ZMConfig('development', $init_conf);
|
||||||
} catch (ConfigException $e) {
|
} catch (ConfigException $e) {
|
||||||
$this->fail($e->getMessage());
|
$this->fail($e->getMessage());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,9 @@ class ZMRequestTest extends TestCase
|
|||||||
|
|
||||||
public function testGet()
|
public function testGet()
|
||||||
{
|
{
|
||||||
$r = ZMRequest::get('http://ip.zhamao.xin');
|
$r = ZMRequest::get('http://httpbin.org/get', [
|
||||||
$this->assertStringContainsString('114', $r);
|
'X-Test' => '123',
|
||||||
|
]);
|
||||||
|
$this->assertStringContainsString('123', $r);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user