friendsofhyperf/pest-plugin-hyperf

Pest Hyperf 插件。

v3.1.31 2024-06-17 01:41 UTC

README

Latest Stable Version Total Downloads License

这是一个 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);
})();

联系方式

许可证

MIT