From ee9de6480767ba81183b785f07e0535615eec046 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Wed, 13 Mar 2024 11:13:25 +0100 Subject: [PATCH] Added test-case for deprecated phpstorm stub with patch-version --- .../PhpStormStubsSourceStubberTest.php | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/test/unit/SourceLocator/SourceStubber/PhpStormStubsSourceStubberTest.php b/test/unit/SourceLocator/SourceStubber/PhpStormStubsSourceStubberTest.php index 84c34b9f7..4644077d5 100644 --- a/test/unit/SourceLocator/SourceStubber/PhpStormStubsSourceStubberTest.php +++ b/test/unit/SourceLocator/SourceStubber/PhpStormStubsSourceStubberTest.php @@ -501,6 +501,39 @@ public function testStubForConstantThatIsDeprecated(): void self::assertSame('filter', $stubData->getExtensionName()); } + public function testStubForConstantThatIsDeprecatedInPatchRelease(): void + { + // use a faked stub to make this test independent of the actual PHP version + $exampleStub = <<<'EOT' +getStub(), + ); + + if (PHP_VERSION_ID >= 80100) { + self::assertStringContainsString( + '@deprecated 8.1.2', + $stubData->getStub(), + ); + } else { + self::assertStringNotContainsString( + '@deprecated 8.1.2', + $stubData->getStub(), + ); + } + + self::assertNull($stubData->getExtensionName()); + } + public function testNoStubForConstantThatDoesNotExist(): void { self::assertNull($this->sourceStubber->generateConstantStub('SOME_CONSTANT'));