Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 9b80ffd

Browse files
renovate[bot]Slamdunk
andauthored
Update dependency phpunit/phpunit to ^12.1.0 (#53)
* Update dependency phpunit/phpunit to ^12.1.0 | datasource | package | from | to | | ---------- | --------------- | ------- | ------ | | packagist | phpunit/phpunit | 12.0.10 | 12.1.0 | * Now PHPUnit creates its own error_log file --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Filippo Tessarotto <zoeslam@gmail.com>
1 parent a5f3cc9 commit 9b80ffd

File tree

3 files changed

+23
-16
lines changed

3 files changed

+23
-16
lines changed

‎composer.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"phpstan/phpstan": "^2.1.11",
1818
"phpstan/phpstan-phpunit": "^2.0.6",
1919
"phpstan/phpstan-strict-rules": "^2.0.4",
20-
"phpunit/phpunit": "^12.0.10",
20+
"phpunit/phpunit": "^12.1.0",
2121
"slam/php-cs-fixer-extensions": "^3.12",
2222
"symfony/console": "^7.2.5"
2323
},

‎phpstan-baseline.neon‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,15 @@ parameters:
4242
count: 1
4343
path: tests/ErrorHandlerTest.php
4444

45+
-
46+
message: '#^Parameter \#1 \$filename of function file_get_contents expects string, string\|false given\.$#'
47+
identifier: argument.type
48+
count: 4
49+
path: tests/ErrorHandlerTest.php
50+
51+
-
52+
message: '#^Parameter \#1 \$filename of function filesize expects string, string\|false given\.$#'
53+
identifier: argument.type
54+
count: 2
55+
path: tests/ErrorHandlerTest.php
56+

‎tests/ErrorHandlerTest.php‎

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212

1313
final class ErrorHandlerTest extends TestCase
1414
{
15-
private string $backupErrorLog;
16-
private string $errorLog;
1715
private ErrorException $exception;
1816

1917
/** @var list<array{subject: string, body: string}> */
@@ -23,11 +21,6 @@ final class ErrorHandlerTest extends TestCase
2321

2422
protected function setUp(): void
2523
{
26-
$this->backupErrorLog = (string) \ini_get('error_log');
27-
$this->errorLog = __DIR__ . \DIRECTORY_SEPARATOR . 'error_log_test';
28-
\touch($this->errorLog);
29-
\ini_set('error_log', $this->errorLog);
30-
3124
$this->exception = new ErrorException(\uniqid('normal_'), \E_USER_NOTICE);
3225
$this->errorHandler = new ErrorHandler(function (string $subject, string $body): void {
3326
$this->emailsSent[] = [
@@ -43,8 +36,6 @@ protected function setUp(): void
4336
protected function tearDown(): void
4437
{
4538
\putenv('COLUMNS');
46-
\ini_set('error_log', $this->backupErrorLog);
47-
@\unlink($this->errorLog);
4839
if ($this->unregister) {
4940
\restore_exception_handler();
5041
\restore_error_handler();
@@ -138,7 +129,8 @@ public function testHandleWebExceptionWithDisplay(): void
138129

139130
self::assertStringContainsString($this->exception->getMessage(), $output);
140131

141-
$errorLogContent = (string) \file_get_contents($this->errorLog);
132+
self::expectErrorLog();
133+
$errorLogContent = (string) \file_get_contents(\ini_get('error_log'));
142134
self::assertStringContainsString($this->exception->getMessage(), $errorLogContent);
143135
}
144136

@@ -154,7 +146,8 @@ public function testHandleWebExceptionWithoutDisplay(): void
154146

155147
self::assertStringNotContainsString($this->exception->getMessage(), $output);
156148

157-
$errorLogContent = (string) \file_get_contents($this->errorLog);
149+
self::expectErrorLog();
150+
$errorLogContent = (string) \file_get_contents(\ini_get('error_log'));
158151
self::assertStringContainsString($this->exception->getMessage(), $errorLogContent);
159152
}
160153

@@ -164,15 +157,16 @@ public function testLogErrorAndException(): void
164157

165158
$this->errorHandler->logException($this->exception);
166159

167-
self::assertSame(0, \filesize($this->errorLog));
160+
self::assertSame(0, \filesize(\ini_get('error_log')));
168161

169162
$this->errorHandler->setLogErrors(true);
170163

171164
$exception = new ErrorException(\uniqid(), \E_USER_ERROR, \E_ERROR, __FILE__, 1, $this->exception);
172165

173166
$this->errorHandler->logException($exception);
174167

175-
$errorLogContent = (string) \file_get_contents($this->errorLog);
168+
self::expectErrorLog();
169+
$errorLogContent = (string) \file_get_contents(\ini_get('error_log'));
176170

177171
self::assertStringContainsString($exception->getMessage(), $errorLogContent);
178172
self::assertStringContainsString($this->exception->getMessage(), $errorLogContent);
@@ -236,7 +230,8 @@ public function testErroriNellInvioDellaMailVengonoComunqueLoggati(): void
236230

237231
$errorHandler->emailException($this->exception);
238232

239-
$errorLogContent = (string) \file_get_contents($this->errorLog);
233+
self::expectErrorLog();
234+
$errorLogContent = (string) \file_get_contents(\ini_get('error_log'));
240235
self::assertStringNotContainsString($this->exception->getMessage(), $errorLogContent);
241236
self::assertStringContainsString($mailError, $errorLogContent);
242237
}
@@ -323,7 +318,7 @@ public function testCanSetCustomErrorLogCallback(): void
323318

324319
$this->errorHandler->logException($this->exception);
325320

326-
self::assertSame(0, \filesize($this->errorLog));
321+
self::assertSame(0, \filesize(\ini_get('error_log')));
327322
self::assertStringContainsString($this->exception->getMessage(), \var_export($data, true));
328323
}
329324
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /