From 6a3d18ecfc8379c51b6e6ea6c89aa76afcaa0ca5 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Thu, 13 Apr 2017 12:02:44 +0200 Subject: [PATCH] TASK: Add further test cases to GenericConstantUsageSniff * To show what's also working and what will potentially provide non helpful warnings. Relates: #64 --- .../GenericConstantUsageSniff/Expected.json | 31 +++++++++++++++++-- .../InputFileForIssues.php | 6 ++++ 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/tests/Fixtures/Standards/Typo3Update/Sniffs/Removed/GenericConstantUsageSniff/Expected.json b/tests/Fixtures/Standards/Typo3Update/Sniffs/Removed/GenericConstantUsageSniff/Expected.json index 6e63f1d..e3072f3 100644 --- a/tests/Fixtures/Standards/Typo3Update/Sniffs/Removed/GenericConstantUsageSniff/Expected.json +++ b/tests/Fixtures/Standards/Typo3Update/Sniffs/Removed/GenericConstantUsageSniff/Expected.json @@ -20,14 +20,41 @@ "severity": 5, "source": "Typo3Update.Removed.GenericConstantUsage.TYPO3_MOD_PATH", "type": "WARNING" + }, + { + "column": 75, + "fixable": false, + "line": 24, + "message": "Legacy calls are not allowed; found constant \\TYPO3\\CMS\\IndexedSearch\\Controller\\SearchFormController::WILDCARD_LEFT. Removed in 7.6. Use \\TYPO3\\CMS\\IndexedSearch\\Utility\\LikeWildcard::LEFT instead. See: https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.6/Breaking-69227-StringsForLikeAreNotProperlyEscaped.html", + "severity": 5, + "source": "Typo3Update.Removed.GenericConstantUsage.SearchFormController.WILDCARD_LEFT", + "type": "WARNING" + }, + { + "column": 39, + "fixable": false, + "line": 27, + "message": "Legacy calls are not allowed; found constant \\TYPO3\\CMS\\IndexedSearch\\Controller\\SearchFormController::WILDCARD_LEFT. Removed in 7.6. Use \\TYPO3\\CMS\\IndexedSearch\\Utility\\LikeWildcard::LEFT instead. See: https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.6/Breaking-69227-StringsForLikeAreNotProperlyEscaped.html", + "severity": 5, + "source": "Typo3Update.Removed.GenericConstantUsage.SearchFormController.WILDCARD_LEFT", + "type": "WARNING" + }, + { + "column": 66, + "fixable": false, + "line": 29, + "message": "Legacy calls are not allowed; found constant \\TYPO3\\CMS\\IndexedSearch\\Controller\\SearchFormController::WILDCARD_LEFT. Removed in 7.6. Use \\TYPO3\\CMS\\IndexedSearch\\Utility\\LikeWildcard::LEFT instead. See: https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.6/Breaking-69227-StringsForLikeAreNotProperlyEscaped.html", + "severity": 5, + "source": "Typo3Update.Removed.GenericConstantUsage.SearchFormController.WILDCARD_LEFT", + "type": "WARNING" } ], - "warnings": 2 + "warnings": 5 } }, "totals": { "errors": 0, "fixable": 0, - "warnings": 2 + "warnings": 5 } } diff --git a/tests/Fixtures/Standards/Typo3Update/Sniffs/Removed/GenericConstantUsageSniff/InputFileForIssues.php b/tests/Fixtures/Standards/Typo3Update/Sniffs/Removed/GenericConstantUsageSniff/InputFileForIssues.php index 944af55..1a199ae 100644 --- a/tests/Fixtures/Standards/Typo3Update/Sniffs/Removed/GenericConstantUsageSniff/InputFileForIssues.php +++ b/tests/Fixtures/Standards/Typo3Update/Sniffs/Removed/GenericConstantUsageSniff/InputFileForIssues.php @@ -21,3 +21,9 @@ $file = PATH_tslib . 'something.php'; $module = TYPO3_MOD_PATH . '/folder'; +$someVariable = \TYPO3\CMS\IndexedSearch\Controller\SearchFormController::WILDCARD_LEFT . '/folder'; +use \TYPO3\CMS\IndexedSearch\Controller\SearchFormController; +// Will work, as we only check last part of class name. +$someVariable = SearchFormController::WILDCARD_LEFT . '/folder'; +// Also matches, as we don't check whole name for now, to enable the above check with imported name. +$someVariable = \Vendor\ExtName\Controller\SearchFormController::WILDCARD_LEFT . '/folder';