Closed carlos-granados closed 7 months ago
Hi, @carlos-granados! Thanks for your contribution! We're looking into it and keep you posted.
There is one issue which I have been unable to solve: currently when you run the behat tests with this new driver, any request performed by the tests is understood by blackfire.io as coming from a command, not an HTTP request. So it will apply the asserttions that you have defined for your commands, not your requests. I tried to add more parameters to the
$_SERVER
variable but this did not seem to help. Since I don't have access to the details of how the probe or the site identifies a request as coming from a command or a real request I could not do anything else. If someone has these details and could share them, I can add whatever is needed
Hello,
To fix this, you should emulate the server by populating appropriate keys to the $_SERVER
global: REQUEST_METHOD
, REQUEST_URI
, SERVER_ADDR
, SERVER_SOFTWARE
, SERVER_PORT'
, HTTPS
, HTTP_HOST
, HTTP_USER_AGENT
@romainneutron I tried adding the missing $_SERVER properties, see the new commit, but it is not still recognised as an HTTP request and is treated as a command
So @romainneutron @thomasdiluccio what are your thoughts about this? Do you think it might be merged and released?
@romainneutron @thomasdiluccio thanks for your comments. I added a few changes
Thanks @carlos-granados Merged as of https://github.com/blackfireio/php-sdk/commit/492add933e68f3af583a16ea4bdaef15b22e1e5d
@romainneutron now that this has been merged I guess that before it is released this documentation needs to be updated: https://docs.blackfire.io/php/integrations/behat However, this documentation does not seem to be open sourced, so I guess it will need to be updated on your side. Let me know if I can help in any way.
@carlos-granados I'm checking to give you access to the doc repo with @thomasdiluccio
Hello @carlos-granados Repo has been published here https://github.com/blackfireio/documentation Could you can submit doc changes there? Thanks !
@romainneutron I created a pull request with the documentation changes: https://github.com/blackfireio/documentation/pull/1
Currently the Behat driver only supports doing real HTTP requests when running the Behat tests. But it is much better to use the Symfony kernel browser which just simulates the requests without actually performing them, thus making the Behat tests much faster.
The Blackfire PHP SDK already contained a class,
Blackfire\Bridge\Symfony\BlackfiredKernelBrowser
which could be used to activate Blackfire when using the Symfony kernel browser but this class was not used anywhere. This PR just adds the configuration and drivers needed to be able to use this class.I have named the new driver with the
blackfire_symfony
name, so that this could be used like this:If instead of
blackfire_symfony
we usedblackfire
we would use the existing driver which does real HTTP requests.There is one issue which I have been unable to solve: currently when you run the behat tests with this new driver, any request performed by the tests is understood by blackfire.io as coming from a command, not an HTTP request. So it will apply the asserttions that you have defined for your commands, not your requests. I tried to add more parameters to the
$_SERVER
variable but this did not seem to help. Since I don't have access to the details of how the probe or the site identifies a request as coming from a command or a real request I could not do anything else. If someone has these details and could share them, I can add whatever is needed