Skip to content

Instantly share code, notes, and snippets.

@wizardishungry
Last active August 29, 2015 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wizardishungry/a3ebb838aa3dbfe44e2d to your computer and use it in GitHub Desktop.
Save wizardishungry/a3ebb838aa3dbfe44e2d to your computer and use it in GitHub Desktop.
testcase for phpunit process isolation bug
I ran into a problem where php was invoking the wrong command-line for process isolation. This occurs when the script calling php is a #!/usr/bin/php called via direct execution
php ../publications/util_scripts/CommitTest.php -c
└─sh -c phpunit /opt/git/ReleaseApp/vendor/mm/publications/util_scripts/../library/Mmf/Test/Suite/Integration/CodeLibrary.php
└─phpunit /usr/bin/phpunit /opt/git/ReleaseApp/vendor/mm/publications/util_scripts/../library/Mmf/Test/Suite/Integration/CodeLibrary.php
└─sh -c '../publications/util_scripts/CommitTest.php'
└─php ../publications/util_scripts/CommitTest.php
└─sh -c phpunit /opt/git/ReleaseApp/vendor/mm/publications/util_scripts/../library/Mmf/Test/Suite/Integration/Frontend.php
└─phpunit /usr/bin/phpunit /opt/git/ReleaseApp/vendor/mm/publications/util_scripts/../library/Mmf/Test/Suite/Integration/Frontend.php
TEST:
./harnass.php go
BREAKS
php ./harnass.php go
WORKS
<?php
/**
* @runTestsInSeparateProcesses
*/
class MyCase extends PHPUnit_Framework_TestCase
{
public function testWhatHappensNext()
{
//sleep(10);
$this->assertFalse(false);
}
}
#!/usr/bin/env php
<?php
if(@$argv[1] != "go") {
echo "Run this testcase by `./harnass.php go`\n";
exit;
}
echo "in test harnass, going to run phpunit";
passthru("phpunit -v -v --debug Case.php");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment