FEATURE: Test for removed extension key sniff added

This commit is contained in:
Daniel Hürtgen 2017-04-11 12:39:22 +02:00
parent 269004947d
commit 4461e116db
3 changed files with 104 additions and 0 deletions

View file

@ -0,0 +1,58 @@
<?php
/**
* Created by PhpStorm.
* User: dah
* Date: 11.04.17
* Time: 12:12
*/
class Typo3Update_Sniffs_Removed_ExtensionKeySniff extends \Typo3Update\Sniffs\Removed\AbstractGenericUsage
{
/**
* Return file names containing removed configurations.
*
* @return array<string>
*/
protected function getRemovedConfigFiles()
{
return [];
}
/**
* The original call, to allow user to check matches.
*
* As we match the name, that can be provided by multiple classes, you
* should provide an example, so users can check that this is the legacy
* one.
*
* @param array $config
*
* @return string
*/
protected function getOldUsage(array $config)
{
return '';
}
/**
* Registers the tokens that this sniff wants to listen for.
*
* An example return value for a sniff that wants to listen for whitespace
* and any comments would be:
*
* <code>
* return array(
* T_WHITESPACE,
* T_DOC_COMMENT,
* T_COMMENT,
* );
* </code>
*
* @return int[]
* @see Tokens.php
*/
public function register()
{
return [];
}
}

View file

@ -0,0 +1,24 @@
{
"files": {
"InputFileForIssues.php": {
"errors": 0,
"messages": [
{
"column": 63,
"fixable": false,
"line": 22,
"message": "Legacy extension are not allowed; found \"perm\"",
"severity": 5,
"source": "Typo3Update.Removed.ExtensionKey.legacyKey",
"type": "WARNING"
}
],
"warnings": 1
}
},
"totals": {
"errors": 0,
"fixable": 0,
"warnings": 1
}
}

View file

@ -0,0 +1,22 @@
<?php
/*
* Copyright (C) 2017 Daniel Siepmann <coding@daniel-siepmann.de>
*
* 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.
*/
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('perm');