File tree Expand file tree Collapse file tree 2 files changed +33
-29
lines changed
Expand file tree Collapse file tree 2 files changed +33
-29
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace PostHog \Test ;
4+
5+ /**
6+ * Mock error handler to capture and verify error reporting
7+ */
8+ class MockErrorHandler
9+ {
10+ private $ errors = [];
11+
12+ public function handleError ($ code , $ message )
13+ {
14+ $ this ->errors [] = ['code ' => $ code , 'message ' => $ message ];
15+ }
16+
17+ public function hasError ($ code )
18+ {
19+ foreach ($ this ->errors as $ error ) {
20+ if ($ error ['code ' ] === $ code ) {
21+ return true ;
22+ }
23+ }
24+ return false ;
25+ }
26+
27+ public function getErrors ()
28+ {
29+ return $ this ->errors ;
30+ }
31+ }
Original file line number Diff line number Diff line change 44
55use PHPUnit \Framework \TestCase ;
66use PostHog \Client ;
7+ use PostHog \Test \MockErrorHandler ;
78
89/**
910 * Test suite for the 32KB payload size limit fix.
10- *
11+ *
1112 * This addresses the critical data loss issue where events exceeding 32KB
1213 * when batched together were silently dropped instead of being split and sent.
1314 */
@@ -209,31 +210,3 @@ public function testNormalSizedBatches(): void
209210 $ this ->assertEquals (1 , $ requestCount , "Only one request should be made for normal batch " );
210211 }
211212}
212-
213- /**
214- * Mock error handler to capture and verify error reporting
215- */
216- class MockErrorHandler
217- {
218- private $ errors = [];
219-
220- public function handleError ($ code , $ message )
221- {
222- $ this ->errors [] = ['code ' => $ code , 'message ' => $ message ];
223- }
224-
225- public function hasError ($ code )
226- {
227- foreach ($ this ->errors as $ error ) {
228- if ($ error ['code ' ] === $ code ) {
229- return true ;
230- }
231- }
232- return false ;
233- }
234-
235- public function getErrors ()
236- {
237- return $ this ->errors ;
238- }
239- }
You can’t perform that action at this time.
0 commit comments