Skip to content

Commit

Permalink
Added test-case for deprecated phpstorm stub with patch-version
Browse files Browse the repository at this point in the history
  • Loading branch information
staabm committed Mar 13, 2024
1 parent ab47d0b commit ee9de64
Showing 1 changed file with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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'
<?php
/**
* @deprecated 8.1.2
*/
\define('A_CUSTOM_CONSTANT', 513);
EOT;
$stubData = new StubData($exampleStub, null);

self::assertStringMatchesFormat(
"%Adefine('A_CUSTOM_CONSTANT',%w%d);",
$stubData->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'));
Expand Down

0 comments on commit ee9de64

Please sign in to comment.