Skip to content

Commit 50dbe28

Browse files
committed
Fixed "Expecting E_WARNING and E_USER_WARNING is deprecated and will no longer be possible in PHPUnit 10."
1 parent 25a3bbe commit 50dbe28

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

test/unit/SourceLocator/Type/AutoloadSourceLocator/FileReadTrapStreamWrapperTest.php

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,11 @@
66

77
use Exception;
88
use LogicException;
9-
use PHPUnit\Framework\Error\Warning;
109
use PHPUnit\Framework\TestCase;
1110
use Roave\BetterReflection\SourceLocator\Type\AutoloadSourceLocator\FileReadTrapStreamWrapper;
1211
use Throwable;
1312
use UnexpectedValueException;
1413

15-
use function class_exists;
1614
use function file_get_contents;
1715
use function is_file;
1816
use function sprintf;
@@ -179,15 +177,8 @@ static function () use ($thrown): string {
179177

180178
public function testWillRaiseWarningWhenTryingToCheckFileExistenceForNonExistingFileWithoutSilencingModifier(): void
181179
{
182-
self::assertTrue(
183-
class_exists(Warning::class),
184-
'The warning class should not be autoloaded lazily for this specific test',
185-
);
186-
187180
$nonExistingFile = __DIR__ . uniqid('non-existing-file', true);
188181

189-
$this->expectWarning();
190-
191182
self::assertSame(
192183
'another value produced by the function',
193184
FileReadTrapStreamWrapper::withStreamWrapperOverride(
@@ -196,7 +187,7 @@ static function () use ($nonExistingFile): string {
196187
throw new UnexpectedValueException('is_file() should report `false` for a non-existing file');
197188
}
198189

199-
if (file_get_contents($nonExistingFile) !== false) {
190+
if (@file_get_contents($nonExistingFile) !== false) {
200191
throw new UnexpectedValueException('file_get_contents() should report `false` for a non-existing file');
201192
}
202193

0 commit comments

Comments
 (0)