File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -258,6 +258,24 @@ disabled then the exception will be thrown.
258258./vendor/bin/pest
259259```
260260
261+ ### Using ` Segment::fake() ` in tests
262+
263+ To prevent real HTTP requests when running your own test suite, call
264+ ` Segment::fake() ` before executing the code under test. This swaps the
265+ Segment service with a fake that records events and identity calls. You can
266+ then use assertion helpers to verify what was sent:
267+
268+ ``` php
269+ use SlashEquip\LaravelSegment\Facades\Segment;
270+
271+ Segment::fake();
272+
273+ // Code that should trigger Segment events
274+
275+ Segment::assertTracked('User Signed Up');
276+ Segment::assertIdentified();
277+ ```
278+
261279## Changelog
262280
263281Please see [ CHANGELOG] ( CHANGELOG.md ) for more information on what has changed recently.
You can’t perform that action at this time.
0 commit comments