Search code examples
phpwindowphpunitcodeceptionphp-5.6

Use of undefined constant SIGTERM - > assumed 'SIGTERM'


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

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

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.

My PHP setup:

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

Codeception PHP Testing Framework v2.2.9

phiremock-codeception-extension

phiremock-codeception-extension v1.2.2

Solution

  • 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..

    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.


    Update

    This issue has beend fixed in phiremock-codeception-extension v.1.2.3.