php - Passing parameters to PHPUnit -
i'm starting write phpunit tests , i'd tests run developers machines our servers. developers machines set differently servers , differently each other.
to run in these different places seems person runs test going have indicate it's being run. test can proper config of machine it's running on.
i'm imagining like:
phpunit.bat -x johns_laptop unittest.php
or on alpha server:
phpunit -x alpha unittest.php
in test able value if 'x' (or whatever is) parameter , know, example, path app root machine.
it doesn't command line allows - or have missed something?
one way inspect $argv , $argc. like:
<?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 can call phpunittest this:
phpunit environmenttest.php my-computer
Comments
Post a Comment