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

Update dependency phpunit/phpunit to ^12.1.0 #53

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Slamdunk merged 2 commits into master from renovate/all-minor-patch
Apr 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"phpstan/phpstan": "^2.1.11",
"phpstan/phpstan-phpunit": "^2.0.6",
"phpstan/phpstan-strict-rules": "^2.0.4",
"phpunit/phpunit": "^12.0.10",
"phpunit/phpunit": "^12.1.0",
"slam/php-cs-fixer-extensions": "^3.12",
"symfony/console": "^7.2.5"
},
Expand Down
12 changes: 12 additions & 0 deletions phpstan-baseline.neon
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,15 @@ parameters:
count: 1
path: tests/ErrorHandlerTest.php

-
message: '#^Parameter \#1 \$filename of function file_get_contents expects string, string\|false given\.$#'
identifier: argument.type
count: 4
path: tests/ErrorHandlerTest.php

-
message: '#^Parameter \#1 \$filename of function filesize expects string, string\|false given\.$#'
identifier: argument.type
count: 2
path: tests/ErrorHandlerTest.php

25 changes: 10 additions & 15 deletions tests/ErrorHandlerTest.php
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@

final class ErrorHandlerTest extends TestCase
{
private string $backupErrorLog;
private string $errorLog;
private ErrorException $exception;

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

protected function setUp(): void
{
$this->backupErrorLog = (string) \ini_get('error_log');
$this->errorLog = __DIR__ . \DIRECTORY_SEPARATOR . 'error_log_test';
\touch($this->errorLog);
\ini_set('error_log', $this->errorLog);

$this->exception = new ErrorException(\uniqid('normal_'), \E_USER_NOTICE);
$this->errorHandler = new ErrorHandler(function (string $subject, string $body): void {
$this->emailsSent[] = [
Expand All @@ -43,8 +36,6 @@ protected function setUp(): void
protected function tearDown(): void
{
\putenv('COLUMNS');
\ini_set('error_log', $this->backupErrorLog);
@\unlink($this->errorLog);
if ($this->unregister) {
\restore_exception_handler();
\restore_error_handler();
Expand Down Expand Up @@ -138,7 +129,8 @@ public function testHandleWebExceptionWithDisplay(): void

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

$errorLogContent = (string) \file_get_contents($this->errorLog);
self::expectErrorLog();
$errorLogContent = (string) \file_get_contents(\ini_get('error_log'));
self::assertStringContainsString($this->exception->getMessage(), $errorLogContent);
}

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

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

$errorLogContent = (string) \file_get_contents($this->errorLog);
self::expectErrorLog();
$errorLogContent = (string) \file_get_contents(\ini_get('error_log'));
self::assertStringContainsString($this->exception->getMessage(), $errorLogContent);
}

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

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

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

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

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

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

$errorLogContent = (string) \file_get_contents($this->errorLog);
self::expectErrorLog();
$errorLogContent = (string) \file_get_contents(\ini_get('error_log'));

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

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

$errorLogContent = (string) \file_get_contents($this->errorLog);
self::expectErrorLog();
$errorLogContent = (string) \file_get_contents(\ini_get('error_log'));
self::assertStringNotContainsString($this->exception->getMessage(), $errorLogContent);
self::assertStringContainsString($mailError, $errorLogContent);
}
Expand Down Expand Up @@ -323,7 +318,7 @@ public function testCanSetCustomErrorLogCallback(): void

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

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

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /