Passing parameters to PHPUnit

后端 未结 9 645
我寻月下人不归
我寻月下人不归 2020-12-24 11:03

I\'m starting to write PHPUnit tests and I\'d like the tests to be run from developers machines as well as from our servers. Developers machines are set up differently than

9条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-24 11:33

    One way would be for you to inspect $argv and $argc. Something like:

    assertGreaterThan(2, $argc, 'No environment name passed');
                $environment = $argv[2];
        }
    }
    

    Then you can call your phpunittest like this:

    phpunit EnvironmentTest.php my-computer
    

提交回复
热议问题