I'm trying to use Encrypted secrets from Github to phpunit.
I created some encrypted Secrets in Github, and I tested that in my workflow file :
- name: Execute tests
env:
TWITTER_ACCESS_TOKEN: ${{ secrets.TWITTER_ACCESS_TOKEN }}
TWITTER_ACCESS_TOKEN_SECRET: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }}
TWITTER_ACCOUNT_ID: ${{ secrets.TWITTER_ACCOUNT_ID }}
TWITTER_BEARER_TOKEN: ${{ secrets.TWITTER_BEARER_TOKEN }}
TWITTER_CONSUMER_KEY: ${{ secrets.TWITTER_CONSUMER_KEY }}
TWITTER_CONSUMER_SECRET: ${{ secrets.TWITTER_CONSUMER_SECRET }}
run: vendor/bin/phpunit
But in my Test file, a simple var_dump($_ENV)
is empty (array(0) { }
), and my tests don't work.
What is missing ?
Best regards.
Thanks for your help.
after various tests I realized that $_ENV
is not the same as getenv()
.
So something like that works:
foreach (getenv() as $settingKey => $settingValue) {
if (strpos($settingKey, 'TWITTER_') === 0) {
...
}
}
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다