From c3f13491a5db881000dd4fe553a41ac82328c7c7 Mon Sep 17 00:00:00 2001 From: Laurent Laville Date: Tue, 18 Aug 2020 12:35:36 +0000 Subject: [PATCH] reorganize unit test case gh-218 --- tests/PhpFeaturesIssueTest.php | 26 --------------- tests/Sniffs/MagicClassConstantSniffTest.php | 32 ++++++++++++++++++- .../fixtures/{ => sniffs/constants}/gh218.php | 0 3 files changed, 31 insertions(+), 27 deletions(-) rename tests/fixtures/{ => sniffs/constants}/gh218.php (100%) diff --git a/tests/PhpFeaturesIssueTest.php b/tests/PhpFeaturesIssueTest.php index ecfbab7b..fbe368a0 100644 --- a/tests/PhpFeaturesIssueTest.php +++ b/tests/PhpFeaturesIssueTest.php @@ -35,7 +35,6 @@ final class PhpFeaturesIssueTest extends \PHPUnit\Framework\TestCase private const GH168 = 'gh168.php'; private const GH213 = 'gh213.php'; private const GH215 = 'gh215.php'; - private const GH218 = 'gh218.php'; private const GH222 = 'gh222.php'; private const GH228 = 'gh228.php'; private const GH238 = 'gh238.php'; @@ -195,31 +194,6 @@ public function testFeatureGH215() ); } - /** - * Regression test for feature GH#218 - * - * @link https://github.com/llaville/php-compat-info/issues/218 - * "::class" not detected as php 5.5 - * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.class.class - * @group features - * @return void - */ - public function testFeatureGH218() - { - $dataSource = self::$fixtures . self::GH218; - $analysers = ['compatibility']; - $metrics = self::$api->run($dataSource, $analysers); - $versions = $metrics[self::$analyserId]['versions']; - $this->assertEquals( - [ - 'php.min' => '5.5.0', - 'php.max' => '', - 'php.all' => '5.5.0', - ], - $versions - ); - } - /** * Regression test for feature GH#222 * diff --git a/tests/Sniffs/MagicClassConstantSniffTest.php b/tests/Sniffs/MagicClassConstantSniffTest.php index cefd2e43..12c278d1 100644 --- a/tests/Sniffs/MagicClassConstantSniffTest.php +++ b/tests/Sniffs/MagicClassConstantSniffTest.php @@ -2,7 +2,10 @@ namespace Bartlett\Tests\CompatInfo\Sniffs; -class MagicClassConstantSniffTest extends SniffTestCase +/** + * @link https://github.com/llaville/php-compat-info/issues/218 + */ +final class MagicClassConstantSniffTest extends SniffTestCase { /** * {@inheritDoc} @@ -36,4 +39,31 @@ public function testFetchingClassNameOnObjects() $versions['php.max'] ); } + + /** + * Regression test for issue #218 + * + * @link https://github.com/llaville/php-compat-info/issues/218 + * "::class" not detected as php 5.5 + * @link https://www.php.net/manual/en/language.oop5.basic.php#language.oop5.basic.class.class + * @group features + * @group regression + * @return void + */ + public function testRegressionGH218() + { + $dataSource = self::$fixtures . 'gh218.php'; + $analysers = ['compatibility']; + $metrics = self::$api->run($dataSource, $analysers); + $versions = $metrics[self::$analyserId]['versions']; + + $this->assertEquals( + '5.5.0', + $versions['php.min'] + ); + $this->assertEquals( + '', + $versions['php.max'] + ); + } } diff --git a/tests/fixtures/gh218.php b/tests/fixtures/sniffs/constants/gh218.php similarity index 100% rename from tests/fixtures/gh218.php rename to tests/fixtures/sniffs/constants/gh218.php