使用未定义的常量 SIGTERM - >假定为“SIGTERM"

2022-01-25 00:00:00 window php phpunit php-5.6 codeception

当前在我的 Windows 机器上使用 Codeception 运行 PHPUnit 给我一个错误:

Currently running PHPUnit with Codeception on my Windows machine gives me an error:

[PHPUnit_Framework_Exception]
使用未定义的常量 SIGTERM -假定为SIGTERM"

[PHPUnit_Framework_Exception]
Use of undefined constant SIGTERM - assumed 'SIGTERM'

据我所知,SIGTERM 是 PCNTL,Windows 不支持.这样,这个 CONSTANT 不应该用于在 Windows 环境上运行的测试.完全没有.

As far as I know is that SIGTERM is a constant provided by PCNTL, which is not supported in Windows. In that way this CONSTANT shouldnt be used for a test running on Windows env. at all.

PHP 5.6.17 (cli) (built: Jan  6 2016 13:28:38)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies

PHPUnit

PHPUnit 5.7.15 

代码接收

Codeception PHP Testing Framework v2.2.9

phiremock-codeception-extension

phiremock-codeception-extension v1.2.2

推荐答案

问题在于 phiremock-codeception-extension 使用 SIGTERM 而不检查 OS/PCNTL扩展是可用的.所以我在 GitHub https://github.com/mcustiel/创建了一个错误报告phiremock-codeception-extension/issues/4..

The problem is depending on phiremock-codeception-extension which uses SIGTERM without checking the OS/PCNTL extension is available. So I created a Bug report at GitHub https://github.com/mcustiel/phiremock-codeception-extension/issues/4..

这是受感染的代码行 - https://github.com/mcustiel/phiremock-codeception-extension/blob/master/src/Extension/PhiremockProcess.php#L74

This are the infected code lines - https://github.com/mcustiel/phiremock-codeception-extension/blob/master/src/Extension/PhiremockProcess.php#L74

/**
 * Stops the process.
 */
public function stop()
{
    $this->process->signal(SIGTERM);
    $this->process->stop(3, SIGKILL);
}

一旦开发者解决了问题,我会更新这个答案.

I will update this answer once the problem has been fixed by the developer.

此问题已在 phiremock-codeception-extension v.1.2.3.

相关文章