Skip to content

Commit 54dfd49

Browse files
committed
fix: Resolve PHP linting errors in test files
- Fix whitespace at end of line in docblock - Move MockErrorHandler to separate file to comply with PSR-1 - Add proper import for MockErrorHandler class All tests continue to pass and linting errors are resolved.
1 parent 05b379b commit 54dfd49

File tree

2 files changed

+33
-29
lines changed

2 files changed

+33
-29
lines changed

test/MockErrorHandler.php

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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+
}

test/PayloadSizeLimitFixTest.php

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44

55
use PHPUnit\Framework\TestCase;
66
use 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-
}

0 commit comments

Comments
 (0)