From 34e616355f528679f1aae110c2ddfcd1dbe8c4ec Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Thu, 13 Apr 2017 11:49:53 +0200 Subject: [PATCH] TASK: Add missing test for GenericConstantUsageSniff Relates: #64 --- .../GenericConstantUsageSniff/Expected.json | 33 +++++++++++++++++++ .../InputFileForIssues.php | 23 +++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 tests/Fixtures/Standards/Typo3Update/Sniffs/Removed/GenericConstantUsageSniff/Expected.json create mode 100644 tests/Fixtures/Standards/Typo3Update/Sniffs/Removed/GenericConstantUsageSniff/InputFileForIssues.php diff --git a/tests/Fixtures/Standards/Typo3Update/Sniffs/Removed/GenericConstantUsageSniff/Expected.json b/tests/Fixtures/Standards/Typo3Update/Sniffs/Removed/GenericConstantUsageSniff/Expected.json new file mode 100644 index 0000000..6e63f1d --- /dev/null +++ b/tests/Fixtures/Standards/Typo3Update/Sniffs/Removed/GenericConstantUsageSniff/Expected.json @@ -0,0 +1,33 @@ +{ + "files": { + "InputFileForIssues.php": { + "errors": 0, + "messages": [ + { + "column": 9, + "fixable": false, + "line": 22, + "message": "Legacy calls are not allowed; found constant PATH_tslib. Removed in 7.0. The folder and constant no longer exist. See: https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.0/Breaking-61459-RemovalTslib.html", + "severity": 5, + "source": "Typo3Update.Removed.GenericConstantUsage.PATH_tslib", + "type": "WARNING" + }, + { + "column": 11, + "fixable": false, + "line": 23, + "message": "Legacy calls are not allowed; found constant TYPO3_MOD_PATH. Removed in 7.4. It is required to route modules through typo3/mod.php from now on in case the module relies on the definition of those constants. See: https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.4/Breaking-67987-RemovedEntryScriptHandling.html", + "severity": 5, + "source": "Typo3Update.Removed.GenericConstantUsage.TYPO3_MOD_PATH", + "type": "WARNING" + } + ], + "warnings": 2 + } + }, + "totals": { + "errors": 0, + "fixable": 0, + "warnings": 2 + } +} diff --git a/tests/Fixtures/Standards/Typo3Update/Sniffs/Removed/GenericConstantUsageSniff/InputFileForIssues.php b/tests/Fixtures/Standards/Typo3Update/Sniffs/Removed/GenericConstantUsageSniff/InputFileForIssues.php new file mode 100644 index 0000000..944af55 --- /dev/null +++ b/tests/Fixtures/Standards/Typo3Update/Sniffs/Removed/GenericConstantUsageSniff/InputFileForIssues.php @@ -0,0 +1,23 @@ + + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. + */ + +$file = PATH_tslib . 'something.php'; +$module = TYPO3_MOD_PATH . '/folder';