Skip to content

Handle empty API keys with no-op client#135

Draft
marandaneto wants to merge 1 commit intomainfrom
fix/noop-empty-api-key
Draft

Handle empty API keys with no-op client#135
marandaneto wants to merge 1 commit intomainfrom
fix/noop-empty-api-key

Conversation

@marandaneto
Copy link
Copy Markdown
Member

Summary

  • initialize PostHog with a disabled no-op consumer when the API key is missing, null, empty, or trim-empty
  • avoid sending capture/flag requests with an empty api_key
  • add focused coverage for PostHog::init() and direct Client construction

Tests

  • ./vendor/bin/phpunit --no-coverage --filter 'testInitWithoutApiKeyConfiguresNoOpClient|testInitWithEmptyApiKeyConfiguresNoOpClient|testInitWithWhitespaceApiKeyConfiguresNoOpClient|testClientWithNullApiKeyDoesNotSendRequests|testClientWithTrimEmptyApiKeyDoesNotSendRequests' test/PostHogTest.php\n- ./vendor/bin/phpunit --no-coverage (completed with existing warnings/deprecations)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant