为您的 CLI 应用程序提供类似 Dusk 的集成测试

dev-main 2024-04-15 08:36 UTC

This package is auto-updated.

Last update: 2024-09-08 08:35:43 UTC


README

此包为您提供了终端命令的类似 Dusk 的集成测试。在底层,它需要 Unix expect 命令才能正确运行。

警告

此包目前正在积极开发中。API 可能会更改。

注意

如果您正在测试 Laravel 命令,此包目前仅支持 Symfony 风格的命令,尚未更新以支持 Prompts。

示例

以下命令将运行 bellows launch 命令,并从 bellows-tester 目录中回答终端中出现的几个问题。

use Day\Day;

use function Day\command;

command('bellows launch')
    ->fromDir(__DIR__ . '/../../bellows-tester')
    ->question('Which server would you like to use', 'bellows-tester')
    ->question('App Name', 'Bellows Test')
    ->deny('Enable quick deploy')
    ->confirm('Launch now')
    ->waitFor('Launched!', 60)
    ->exec();