fetzi / phpspec-watcher
phpspec-watcher 是一个用于在代码更改时自动执行 phpspec 测试的命令行工具
2.0.1
2020-04-13 15:20 UTC
Requires
- php: ^7.2
- clue/stdio-react: ^2.3
- jolicode/jolinotif: ^2.0.
- react/event-loop: ^1.1
- symfony/console: ^4.0 || ^5.0
- symfony/finder: ^4.0 || ^5.0
- symfony/process: ^4.0 || ^5.0
- symfony/yaml: ^4.0 || ^5.0
Requires (Dev)
- phpunit/phpunit: ^8.4
- squizlabs/php_codesniffer: ^3.5
README
介绍
phpspec-watcher 是一个自动化 phpspec 测试执行的工具,当项目源代码发生变化时。在文件保存时,监视器会自动触发 phpspec 测试套件,并向开发者报告测试结果。
安装
可以使用以下命令全局安装此工具:
composer global require fetzi/phpspec-watcher
或者仅作为某个包的开发依赖项安装
composer require fetzi/phpspec-watcher --dev
用法
全局安装后,可以通过以下命令调用监视器:
phpspec-watcher watch
如果您将监视器作为某个项目开发依赖项安装,您可以在 vendor/bin 目录中找到二进制文件。
vendor/bin/phpspec-watcher watch
配置
监视器可以通过存储在项目根目录中的配置文件 .phpspec-watcher.yml
进行配置。
以下列表显示了文件结构和选项含义
fileMask: '*.php' # file pattern that should be watched checkInterval: 1 # a float value indicating the resource check interval directories: # a list of directories that should be watched - app - src - spec phpspec: binary: vendor/bin/phpspec # path to the phpspec binary arguments: [format=dot] # additional phpspec arguments notifications: # flags for notfications on success and on error onError: true onSuccess: true
为了加快配置过程,有一个初始化命令,用于使用默认值启动配置文件
phpspec-watcher init
通知
监视器在执行测试套件后触发操作系统通知。
要在 Mac 上显示通知图标,您需要安装另一个通知器,因为 AppleScript 无法显示自定义图标
brew install terminal-notifier
鸣谢
创建此包的想法是在发现 Spatie 的 phpunit-watcher 包后产生的。
许可证
MIT 许可证(MIT)。请参阅 许可证文件 了解更多信息。