Skip to content

Commit 96304c7

Browse files
authored
Merge pull request #1548 from staabm/test-real
Test deprecated constant via define()
2 parents f3e83c7 + 8bf16e7 commit 96304c7

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

test/unit/SourceLocator/SourceStubber/PhpStormStubsSourceStubberTest.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -558,6 +558,28 @@ public function testStubForConstantDeclaredByDefine(): void
558558
self::assertStringEndsWith(";\n", $stub->getStub());
559559
}
560560

561+
public function testStubForConstantDeclaredByDefineThatIsDeprecated(): void
562+
{
563+
$stubData = $this->sourceStubber->generateConstantStub('E_STRICT');
564+
565+
self::assertStringContainsString(
566+
"define('E_STRICT', 2048);",
567+
$stubData->getStub(),
568+
);
569+
570+
if (PHP_VERSION_ID >= 80400) {
571+
self::assertStringContainsString(
572+
'@deprecated 8.4',
573+
$stubData->getStub(),
574+
);
575+
} else {
576+
self::assertStringNotContainsString(
577+
'@deprecated 8.4',
578+
$stubData->getStub(),
579+
);
580+
}
581+
}
582+
561583
public function testStubForConstantDeclaredByConst(): void
562584
{
563585
$stub = $this->sourceStubber->generateConstantStub('ast\AST_ARG_LIST');

0 commit comments

Comments
 (0)