0

Basically if php has xdebug installed I want to run tests with code coverage enabled. Otherwise just run the tests without code coverage. Something like this:

if [[ <detect xdebug> ]]; then coverage="--coverage-xml"; fi
vendor/bin/codecept run $coverage

It's easy to know if xdebug enabled using

php -v | grep Xdebug

If this command returns something xdebug is enabled, otherwise it's unavailable.

I just don't know how to use it in the if.

1 Answer 1

2
if php -v | grep -q 'Xdebug'; then
  echo "Xdebug installed"
fi
Sign up to request clarification or add additional context in comments.

3 Comments

I'm well aware of that function. However I need to detect it in shell script, not in php.
Is it possible to do it inside the if? I need it for .travis.yml so a one-liner would be better.
I didn't expect it to be so easy. Works perfectly, thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.