How to debug features in Behat 3 with echo

Adamski picture Adamski · Aug 20, 2014 · Viewed 9.6k times · Source

I am trying to debug a feature in Behat 3 to see what is going on.

Echo statements don't seem to work - I get no output.

The step I'm trying to use currently looks like this:

/**
 * @Then /^echo last request$/
 */

public function echoLastRequest() 
{
    echo ($this->_history->getLastRequest());
    echo 'test';
}

Answer

Rafal Enden picture Rafal Enden · Mar 17, 2016

You could use a simple print_r() or var_export():

var_export('DEBUG!!!');

Debug preview