I need a way to determine if the person calling the function is Travis-CI or not. If it is Travis-CI, I do not want to start a session here. Right now, I have my tests script create a file called test.txt
and then look for it.
protected function __construct() { if ( (!session_id()) && (!file_exists('test.txt' ))) session_start(); }
However, there has to be a better way. It seems, that without the file check, if there is in fact a session made, a new one will not be created. But this is not the case. If this was the case, the before link below should have passed.
Before the addition of the "test.txt" file:
After
As a continuous integration platform, Travis CI supports your development process by automatically building and testing code changes, providing immediate feedback on the success of the change. Travis CI can also automate other parts of your development process by managing deployments and notifications.
Configuration. Travis CI is configured by adding a file named . travis. yml , which is a YAML format text file, to the root directory of the repository.
In general you can detect if you are on Travis-CI by checking the environment variables. You can check either for CI=true
or the more specific TRAVIS=true
. In PHP you can use the getenv()
function to get the value of an environment variable.
See the complete list of the environment. You can set even more env variables in your .travis.yml.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With