Skip to content
This repository has been archived by the owner on Jan 21, 2020. It is now read-only.

Allow using zend-console to determine if a CLI env is in play #100

Merged

Conversation

weierophinney
Copy link
Member

This patch updates #86 to fix #98 by testing if the Zend\Console\Console class is present and, if so, using the return value of its isConsole() method to determine the current SAPI environment. This approach allows overriding the environment for purposes of unit testing incoming HTTP requests.

If the class is not available, we fallback to the PHP_SAPI value.

Fixes #98

This patch updates zfcampus#86 to fix zfcampus#98 by testing if the
`Zend\Console\Console` class is present and, if so, using the return
value of its `isConsole()` method to determine the current SAPI
environment. This approach allows overriding the environment for
purposes of unit testing incoming HTTP requests.

If the class is not available, we fallback to the `PHP_SAPI` value.
@weierophinney weierophinney merged commit cacfa65 into zfcampus:master Nov 21, 2017
weierophinney added a commit that referenced this pull request Nov 21, 2017
weierophinney added a commit that referenced this pull request Nov 21, 2017
weierophinney added a commit that referenced this pull request Nov 21, 2017
@weierophinney weierophinney deleted the hotfix/98-console-detection branch November 21, 2017 16:24
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incompatible changes in RequestFactory
1 participant