// +---------------------------------------------------------------------- namespace tests; class TestCase extends \think\testing\TestCase { protected $baseUrl = 'http://localhost'; public function __construct(?string $name = null, array $data = [], string $dataName = '') { // 引入需要的环境 require_once __DIR__ . '/../thinkphp/base.php'; // 初始化 App 对象,并将 APP_PATH 指向项目的 application 目录 App::getInstance()->path(__DIR__ . '/../application/')->initialize(); parent::__construct($name, $data, $dataName); } }