In this example, I have shared how to pass parameters to PHPUnit? One way would be for you to inspect $argv and $argc. something like below example:
1 2 3 4 5 6 7 8 9 10 11 | <?php require_once 'PHPUnit/Framework/TestCase.php'; class EnvironmentTest extends PHPUnit_Framework_TestCase { public function testHasParam() { global $argv, $argc; $this->assertGreaterThan(2, $argc, 'No environment name passed'); $environment = $argv[2]; } } |
Then you can call your phpunittest like this:
1 | phpunit EnvironmentTest.php my-computer |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.