WIP|FEATURE: Add further tests

* Add new tests and improve existing

Relates: #46
This commit is contained in:
Daniel Siepmann 2017-04-06 11:44:15 +02:00
parent b23ee6ef8b
commit a78d94ab13
Signed by: Daniel Siepmann
GPG key ID: 33D6629915560EF4
8 changed files with 182 additions and 6 deletions

View file

@ -6,7 +6,11 @@
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnError="false"
stopOnFailure="false"
stopOnIncomplete="false"
stopOnSkipped="false"
stopOnRisky="false"
syntaxCheck="false">
<testsuites>

View file

@ -1,8 +1,15 @@
--- tests/Fixtures/Standards/Typo3Update/Sniffs/LegacyClassnames/DocCommentSniff/InputFileForIssues.php
+++ PHP_CodeSniffer
@@ -22,9 +22,9 @@
@@ -22,19 +22,19 @@
class InputFileForIssues
{
/**
- * @var Tx_Extbase_Domain_Repository_CategoryRepository
+ * @var \TYPO3\CMS\Extbase\Domain\Repository\CategoryRepository
* @inject
*/
protected $someVar;
/**
- * @param t3lib_div
+ * @param \TYPO3\CMS\Core\Utility\GeneralUtility
@ -12,3 +19,8 @@
*/
public function doSomething($something)
{
- /** @var t3lib_div $variable */ // This is supported as this is a phpdoc.
+ /** @var \TYPO3\CMS\Core\Utility\GeneralUtility $variable */ // This is supported as this is a phpdoc.
/** @var $variable t3lib_div */ // This is not supported! Use inline comments instead.
}
}

View file

@ -1,12 +1,21 @@
{
"files": {
"InputFileForIssues.php": {
"errors": 2,
"errors": 4,
"messages": [
{
"column": 13,
"fixable": true,
"line": 25,
"message": "Legacy classes are not allowed; found \"Tx_Extbase_Domain_Repository_CategoryRepository\", use \"TYPO3\\CMS\\Extbase\\Domain\\Repository\\CategoryRepository\" instead",
"severity": 5,
"source": "Typo3Update.LegacyClassnames.DocComment.legacyClassname",
"type": "ERROR"
},
{
"column": 15,
"fixable": true,
"line": 25,
"line": 31,
"message": "Legacy classes are not allowed; found \"t3lib_div\", use \"TYPO3\\CMS\\Core\\Utility\\GeneralUtility\" instead",
"severity": 5,
"source": "Typo3Update.LegacyClassnames.DocComment.legacyClassname",
@ -15,19 +24,28 @@
{
"column": 16,
"fixable": true,
"line": 27,
"line": 33,
"message": "Legacy classes are not allowed; found \"Tx_Extbase_Configuration_Configurationmanager\", use \"TYPO3\\CMS\\Extbase\\Configuration\\ConfigurationManager\" instead",
"severity": 5,
"source": "Typo3Update.LegacyClassnames.DocComment.legacyClassname",
"type": "ERROR"
},
{
"column": 18,
"fixable": true,
"line": 37,
"message": "Legacy classes are not allowed; found \"t3lib_div\", use \"TYPO3\\CMS\\Core\\Utility\\GeneralUtility\" instead",
"severity": 5,
"source": "Typo3Update.LegacyClassnames.DocComment.legacyClassname",
"type": "ERROR"
}
],
"warnings": 0
}
},
"totals": {
"errors": 2,
"fixable": 2,
"errors": 4,
"fixable": 4,
"warnings": 0
}
}

View file

@ -21,6 +21,12 @@
class InputFileForIssues
{
/**
* @var Tx_Extbase_Domain_Repository_CategoryRepository
* @inject
*/
protected $someVar;
/**
* @param t3lib_div
*
@ -28,5 +34,7 @@ class InputFileForIssues
*/
public function doSomething($something)
{
/** @var t3lib_div $variable */ // This is supported as this is a phpdoc.
/** @var $variable t3lib_div */ // This is not supported! Use inline comments instead.
}
}

View file

@ -0,0 +1,21 @@
--- tests/Fixtures/Standards/Typo3Update/Sniffs/LegacyClassnames/InheritanceSniff/InputFileForIssues.php
+++ PHP_CodeSniffer
@@ -19,14 +19,14 @@
* 02110-1301, USA.
*/
-class InputFileForIssues extends Tx_Extbase_Configuration_Configurationmanager implements t3lib_Singleton, Tx_Extbase_Core_BootstrapInterface
+class InputFileForIssues extends \TYPO3\CMS\Extbase\Configuration\ConfigurationManager implements \TYPO3\CMS\Core\SingletonInterface, \TYPO3\CMS\Extbase\Core\BootstrapInterface
{
}
-class InputFileForIssues extends Tx_Extbase_Configuration_Configurationmanager implements
- t3lib_Singleton,
- Tx_Extbase_Core_BootstrapInterface
+class InputFileForIssues extends \TYPO3\CMS\Extbase\Configuration\ConfigurationManager implements
+ \TYPO3\CMS\Core\SingletonInterface,
+ \TYPO3\CMS\Extbase\Core\BootstrapInterface
{
}

View file

@ -0,0 +1,24 @@
--- tests/Fixtures/Standards/Typo3Update/Sniffs/LegacyClassnames/InlineCommentSniff/InputFileForIssues.php
+++ PHP_CodeSniffer
@@ -23,16 +23,14 @@
{
public function something()
{
- /* @var $variable Tx_Extbase_Command_HelpCommandController */
+ /* @var $variable \TYPO3\CMS\Extbase\Command\HelpCommandController */
$variable;
- // @var $variable Tx_Extbase_Command_HelpCommandController
+ // @var $variable \TYPO3\CMS\Extbase\Command\HelpCommandController
$variable;
- /* @var Tx_Extbase_Command_HelpCommandController $variable */
+ /* @var \TYPO3\CMS\Extbase\Command\HelpCommandController $variable */
$variable;
- // @var Tx_Extbase_Command_HelpCommandController $variable
+ // @var \TYPO3\CMS\Extbase\Command\HelpCommandController $variable
$variable;
}
}

View file

@ -0,0 +1,51 @@
{
"files": {
"InputFileForIssues.php": {
"errors": 4,
"messages": [
{
"column": 9,
"fixable": true,
"line": 26,
"message": "Legacy classes are not allowed; found \"Tx_Extbase_Command_HelpCommandController\", use \"TYPO3\\CMS\\Extbase\\Command\\HelpCommandController\" instead",
"severity": 5,
"source": "Typo3Update.LegacyClassnames.InlineComment.legacyClassname",
"type": "ERROR"
},
{
"column": 9,
"fixable": true,
"line": 29,
"message": "Legacy classes are not allowed; found \"Tx_Extbase_Command_HelpCommandController\", use \"TYPO3\\CMS\\Extbase\\Command\\HelpCommandController\" instead",
"severity": 5,
"source": "Typo3Update.LegacyClassnames.InlineComment.legacyClassname",
"type": "ERROR"
},
{
"column": 9,
"fixable": true,
"line": 32,
"message": "Legacy classes are not allowed; found \"Tx_Extbase_Command_HelpCommandController\", use \"TYPO3\\CMS\\Extbase\\Command\\HelpCommandController\" instead",
"severity": 5,
"source": "Typo3Update.LegacyClassnames.InlineComment.legacyClassname",
"type": "ERROR"
},
{
"column": 9,
"fixable": true,
"line": 35,
"message": "Legacy classes are not allowed; found \"Tx_Extbase_Command_HelpCommandController\", use \"TYPO3\\CMS\\Extbase\\Command\\HelpCommandController\" instead",
"severity": 5,
"source": "Typo3Update.LegacyClassnames.InlineComment.legacyClassname",
"type": "ERROR"
}
],
"warnings": 0
}
},
"totals": {
"errors": 4,
"fixable": 4,
"warnings": 0
}
}

View file

@ -0,0 +1,38 @@
<?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.
*/
class InputFileForIssues
{
public function something()
{
/* @var $variable Tx_Extbase_Command_HelpCommandController */
$variable;
// @var $variable Tx_Extbase_Command_HelpCommandController
$variable;
/* @var Tx_Extbase_Command_HelpCommandController $variable */
$variable;
// @var Tx_Extbase_Command_HelpCommandController $variable
$variable;
}
}