0

I am using phpunit to test a large php project. The tests are organised in groups using @group annotation. I also have a phpunit.xml file in the root directory of my tests, which, among other things, specifies the bootstrap php file. In that file, I perform some general initialisation before running the tests.

I can run phpunit on the whole project by simply executing phpunit or I can run it for individual groups with phpunit --group ... command. So far, so good.

Now I want my initialisation inside the bootstrap.php to do different things depending on the group that was specified when phpunit was invoked. Yet I cannot find any information on how to access that data inside my bootstrap. Is there any way to find out inside my boostrap.php whether --group ... parameter has been passed and, if yes, what the ... value was specified?

Update: I'm running on PHP 5.5 if it makes any difference.

3
  • Why is this tagged 'bootstrap'? Commented Mar 3, 2015 at 19:23
  • @amphetamachine Why not? Read the description of the tag. Commented Mar 3, 2015 at 20:37
  • Ah, my mistake. Boostrap is a widely misused tag. Commented Mar 3, 2015 at 20:43

1 Answer 1

0

Ok, I gave up a bit too early. All of the parameters are passed inside $_SERVER['argv'], hence

print_r($_SERVER['argv']); 

produces something like this:

Array ( [0] => /usr/bin/phpunit [1] => --group [2] => abc ) 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.