Skip to content

Commit 35c473d

Browse files
authored
单元测试时控制器加属性注解报错
单元测试时$this->clinet->get('/')会报错:InvalidArgumentException : Path Generator is not exists. 因为没有把 Hyperf\JsonRpc\Listener\RegisterProtocolListener 这个注册
1 parent 874cb6b commit 35c473d

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

test/bootstrap.php

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
2-
32
declare(strict_types=1);
3+
44
/**
55
* This file is part of Hyperf.
66
*
@@ -10,12 +10,21 @@
1010
* @license https://github.com/hyperf-cloud/hyperf/blob/master/LICENSE
1111
*/
1212

13+
use Hyperf\Contract\ApplicationInterface;
14+
use Swoole\Runtime;
15+
16+
ini_set('display_errors', 'on');
17+
ini_set('display_startup_errors', 'on');
18+
1319
error_reporting(E_ALL);
20+
date_default_timezone_set('Asia/Shanghai');
21+
22+
!defined('BASE_PATH') && define('BASE_PATH', dirname(__DIR__, 1));
1423

15-
! defined('BASE_PATH') && define('BASE_PATH', dirname(__DIR__, 1));
24+
Runtime::enableCoroutine(true);
1625

17-
\Swoole\Runtime::enableCoroutine(true);
26+
require BASE_PATH.'/vendor/autoload.php';
1827

19-
require BASE_PATH . '/vendor/autoload.php';
28+
$container = require BASE_PATH.'/config/container.php';
2029

21-
require BASE_PATH . '/config/container.php';
30+
$container->get(ApplicationInterface::class);

0 commit comments

Comments
 (0)