friendsofhyperf / pest-plugin-hyperf
Pest Hyperf 插件。
赞助包维护!
huangdijia
hdj.me/sponsors
v3.1.31
2024-06-17 01:41 UTC
Requires
- php: ^8.1
- ext-swoole: *
- hyperf/coordinator: ~3.1.0
- hyperf/di: ~3.1.0
- hyperf/support: ~3.1.0
- pestphp/pest: ^2.8.0
- pestphp/pest-plugin: ^2.0.1
This package is auto-updated.
Last update: 2024-09-25 00:31:36 UTC
README
这是一个 Pest 插件,它使您的 Hyperf 项目的 Pest 能够在基于 Swoole 的协程环境中运行。
安装
composer require friendsofhyperf/pest-plugin-hyperf --dev
使用
php vendor/bin/pest --coroutine
# or
php vendor/bin/pest --prepend test/prepend.php --coroutine
- test/prepend.php
<?php require_once __DIR__ . '/../vendor/autoload.php'; defined('BASE_PATH') or define('BASE_PATH', dirname(__DIR__, 1)); (function () { \Hyperf\Di\ClassLoader::init(); \Hyperf\Context\ApplicationContext::setContainer( new \Hyperf\Di\Container((new \Hyperf\Di\Definition\DefinitionSourceFactory())()) ); // $container->get(Hyperf\Contract\ApplicationInterface::class); })();