Context\Fbc\*, Context\Fbp\* |
cookie parsing (valid, invalid, missing), query override, cache behaviour, no-request behaviour, reset |
StoreFbpSubscriber, StoreFbcSubscriber |
cookie set and renewal after two hours, fbclid presence, consent gate, sub-requests, httpOnly=false |
StoreTestEventCodeSubscriber, PopulateTestEventCodePropertySubscriber |
store, read, clear, no session, no previous session |
PopulateRequestPropertiesSubscriber |
URL, IP and user agent populated; no request |
PopulateFbpAndFbcPropertiesSubscriber, PopulatePixelsSubscriber |
values copied onto the event |
FilterBotsSubscriber, FilterEmptyUserAgentSubscriber, StopPropagationIfNoPixelsHasBeenAddedSubscriber |
stop / do not stop |
ConsentChecker |
disabled → granted; enabled without checker → granted; enabled with checker → delegated with the configured category |
SendEventHandler |
delegates to ClientInterface; behaviour on ClientException |
AddEventToTagBagSubscriber, AddLibraryToTagBagSubscriber |
tags added with the expected priorities and fingerprints, init tag replacement, consent gate, no pixels |
Configuration |
defaults, client_side default depending on tag bag presence, pixels validation, filters.user_agent validation |
SetonoMetaConversionsApiExtension::prepend() |
its behaviour, or its removal |
| End to end |
dispatch a ConversionsApiEventRaised through a booted kernel with a request on the stack and assert: (a) a stubbed ClientInterface receives the event with populated request properties, pixels and fbp; (b) with client side enabled the tag bag contains the pixel, init and track tags; (c) a bot user agent results in nothing being sent |
Current state
vendor/bin/phpunit --coverage-textwith pcov on PHP 8.4:Only
ConfigurationBasedPixelProviderandSetonoMetaConversionsApiExtensionare fully covered. Most subscriber coverage comes fromgetSubscribedEvents()being called during kernel boot, not from their behaviour being exercised.The untested code is exactly where the issues from the review live:
Context\Fbc\*,Context\Fbp\*StoreFbpSubscriber,StoreFbcSubscriberfbclidpresence, consent gate, sub-requests,httpOnly=falseStoreTestEventCodeSubscriber,PopulateTestEventCodePropertySubscriberPopulateRequestPropertiesSubscriberPopulateFbpAndFbcPropertiesSubscriber,PopulatePixelsSubscriberFilterBotsSubscriber,FilterEmptyUserAgentSubscriber,StopPropagationIfNoPixelsHasBeenAddedSubscriberConsentCheckerSendEventHandlerClientInterface; behaviour onClientExceptionAddEventToTagBagSubscriber,AddLibraryToTagBagSubscriberConfigurationclient_sidedefault depending on tag bag presence,pixelsvalidation,filters.user_agentvalidationSetonoMetaConversionsApiExtension::prepend()ConversionsApiEventRaisedthrough a booted kernel with a request on the stack and assert: (a) a stubbedClientInterfacereceives the event with populated request properties, pixels and fbp; (b) with client side enabled the tag bag contains the pixel, init and track tags; (c) a bot user agent results in nothing being sentSuggested approach
Request,RequestStack,RequestEventandResponseEventobjects are cheap for every subscriber; no kernel needed.KernelTestCaseend-to-end test usingNyholm\BundleTest\TestKernel, aClientInterfacestub registered through a test compiler pass, and Messenger in sync mode. This single test would have caught prepend() replaces the application's default Messenger bus #12.