FEATURE: Add all remaining tests

Relates: #46
This commit is contained in:
Daniel Siepmann 2017-04-06 14:23:32 +02:00
parent c8166df601
commit 63d48e01fa
Signed by: Daniel Siepmann
GPG key ID: 33D6629915560EF4
15 changed files with 699 additions and 0 deletions

View file

@ -0,0 +1,52 @@
--- tests/Fixtures/Standards/Typo3Update/Sniffs/LegacyClassnames/MissingVendorForPluginsAndModulesSniff/InputFileForIssues.php
+++ PHP_CodeSniffer
@@ -20,7 +20,7 @@
*/
TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
- $_EXTKEY,
+ 'YourCompany.' . $_EXTKEY,
'name',
[
'Controller' => 'action',
@@ -28,7 +28,7 @@
);
Tx_Extbase_Utility_Extension::configurePlugin(
- $_EXTKEY,
+ 'YourCompany.' . $_EXTKEY,
'name',
[
'Controller' => 'action',
@@ -36,19 +36,19 @@
);
Tx_Extbase_Utility_Extension::registerPlugin(
- $_EXTKEY,
+ 'YourCompany.' . $_EXTKEY,
'name',
'title'
);
TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
- $_EXTKEY,
+ 'YourCompany.' . $_EXTKEY,
'name',
'title'
);
Tx_Extbase_Utility_Extension::registerModule(
- $_EXTKEY,
+ 'YourCompany.' . $_EXTKEY,
'subpart',
'key'
'',
@@ -58,7 +58,7 @@
);
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerModule(
- $_EXTKEY,
+ 'YourCompany.' . $_EXTKEY,
'subpart',
'key'
'',

View file

@ -0,0 +1,69 @@
{
"files": {
"InputFileForIssues.php": {
"errors": 6,
"messages": [
{
"column": 5,
"fixable": true,
"line": 23,
"message": "No vendor is given, that will break TYPO3 handling for namespaced classes. Add vendor before Extensionkey like: \"YourCompany.\" . $_EXTKEY",
"severity": 5,
"source": "Typo3Update.LegacyClassnames.MissingVendorForPluginsAndModules.missingVendor",
"type": "ERROR"
},
{
"column": 5,
"fixable": true,
"line": 31,
"message": "No vendor is given, that will break TYPO3 handling for namespaced classes. Add vendor before Extensionkey like: \"YourCompany.\" . $_EXTKEY",
"severity": 5,
"source": "Typo3Update.LegacyClassnames.MissingVendorForPluginsAndModules.missingVendor",
"type": "ERROR"
},
{
"column": 5,
"fixable": true,
"line": 39,
"message": "No vendor is given, that will break TYPO3 handling for namespaced classes. Add vendor before Extensionkey like: \"YourCompany.\" . $_EXTKEY",
"severity": 5,
"source": "Typo3Update.LegacyClassnames.MissingVendorForPluginsAndModules.missingVendor",
"type": "ERROR"
},
{
"column": 5,
"fixable": true,
"line": 45,
"message": "No vendor is given, that will break TYPO3 handling for namespaced classes. Add vendor before Extensionkey like: \"YourCompany.\" . $_EXTKEY",
"severity": 5,
"source": "Typo3Update.LegacyClassnames.MissingVendorForPluginsAndModules.missingVendor",
"type": "ERROR"
},
{
"column": 5,
"fixable": true,
"line": 51,
"message": "No vendor is given, that will break TYPO3 handling for namespaced classes. Add vendor before Extensionkey like: \"YourCompany.\" . $_EXTKEY",
"severity": 5,
"source": "Typo3Update.LegacyClassnames.MissingVendorForPluginsAndModules.missingVendor",
"type": "ERROR"
},
{
"column": 5,
"fixable": true,
"line": 61,
"message": "No vendor is given, that will break TYPO3 handling for namespaced classes. Add vendor before Extensionkey like: \"YourCompany.\" . $_EXTKEY",
"severity": 5,
"source": "Typo3Update.LegacyClassnames.MissingVendorForPluginsAndModules.missingVendor",
"type": "ERROR"
}
],
"warnings": 0
}
},
"totals": {
"errors": 6,
"fixable": 6,
"warnings": 0
}
}

View file

@ -0,0 +1,118 @@
<?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\Extbase\Utility\ExtensionUtility::configurePlugin(
$_EXTKEY,
'name',
[
'Controller' => 'action',
]
);
Tx_Extbase_Utility_Extension::configurePlugin(
$_EXTKEY,
'name',
[
'Controller' => 'action',
]
);
Tx_Extbase_Utility_Extension::registerPlugin(
$_EXTKEY,
'name',
'title'
);
TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
$_EXTKEY,
'name',
'title'
);
Tx_Extbase_Utility_Extension::registerModule(
$_EXTKEY,
'subpart',
'key'
'',
[
'Controller' => 'action',
]
);
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerModule(
$_EXTKEY,
'subpart',
'key'
'',
[
'Controller' => 'action',
]
);
// Already vendor exists
TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
'Vendor.' . $_EXTKEY,
'name',
[
'Controller' => 'action',
]
);
Tx_Extbase_Utility_Extension::configurePlugin(
'Vendor.' . $_EXTKEY,
'name',
[
'Controller' => 'action',
]
);
Tx_Extbase_Utility_Extension::registerPlugin(
'Vendor.' . $_EXTKEY,
'name',
'title'
);
TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
'Vendor.' . $_EXTKEY,
'name',
'title'
);
Tx_Extbase_Utility_Extension::registerModule(
'Vendor.' . $_EXTKEY,
'subpart',
'key'
'',
[
'Controller' => 'action',
]
);
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerModule(
'Vendor.' . $_EXTKEY,
'subpart',
'key'
'',
[
'Controller' => 'action',
]
);

View file

@ -0,0 +1,21 @@
--- tests/Fixtures/Standards/Typo3Update/Sniffs/LegacyClassnames/StaticCallSniff/InputFileForIssues.php
+++ PHP_CodeSniffer
@@ -19,13 +19,13 @@
* 02110-1301, USA.
*/
-Tx_Extbase_Utility_Extension::configurePlugin(
+\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
$_EXTKEY,
'name',
['Controller' => 'action']
);
-t3lib_div::makeInstance(Tx_Extbase_Command_HelpCommandController::class);
-$this->objectManager->get(\Tx_Extbase_Command_HelpCommandController::class);
+\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Command\HelpCommandController::class);
+$this->objectManager->get(\TYPO3\CMS\Extbase\Command\HelpCommandController::class);
\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Object\ObjectManager)
- ->get(\Tx_Extbase_Command_HelpCommandController::class);
-is_a($a, t3lib_Singleton::class);
+ ->get(\TYPO3\CMS\Extbase\Command\HelpCommandController::class);
+is_a($a, \TYPO3\CMS\Core\SingletonInterface::class);

View file

@ -0,0 +1,69 @@
{
"files": {
"InputFileForIssues.php": {
"errors": 6,
"messages": [
{
"column": 1,
"fixable": true,
"line": 22,
"message": "Legacy classes are not allowed; found \"Tx_Extbase_Utility_Extension\", use \"TYPO3\\CMS\\Extbase\\Utility\\ExtensionUtility\" instead",
"severity": 5,
"source": "Typo3Update.LegacyClassnames.StaticCall.legacyClassname",
"type": "ERROR"
},
{
"column": 1,
"fixable": true,
"line": 27,
"message": "Legacy classes are not allowed; found \"t3lib_div\", use \"TYPO3\\CMS\\Core\\Utility\\GeneralUtility\" instead",
"severity": 5,
"source": "Typo3Update.LegacyClassnames.StaticCall.legacyClassname",
"type": "ERROR"
},
{
"column": 25,
"fixable": true,
"line": 27,
"message": "Legacy classes are not allowed; found \"Tx_Extbase_Command_HelpCommandController\", use \"TYPO3\\CMS\\Extbase\\Command\\HelpCommandController\" instead",
"severity": 5,
"source": "Typo3Update.LegacyClassnames.StaticCall.legacyClassname",
"type": "ERROR"
},
{
"column": 28,
"fixable": true,
"line": 28,
"message": "Legacy classes are not allowed; found \"Tx_Extbase_Command_HelpCommandController\", use \"TYPO3\\CMS\\Extbase\\Command\\HelpCommandController\" instead",
"severity": 5,
"source": "Typo3Update.LegacyClassnames.StaticCall.legacyClassname",
"type": "ERROR"
},
{
"column": 12,
"fixable": true,
"line": 30,
"message": "Legacy classes are not allowed; found \"Tx_Extbase_Command_HelpCommandController\", use \"TYPO3\\CMS\\Extbase\\Command\\HelpCommandController\" instead",
"severity": 5,
"source": "Typo3Update.LegacyClassnames.StaticCall.legacyClassname",
"type": "ERROR"
},
{
"column": 10,
"fixable": true,
"line": 31,
"message": "Legacy classes are not allowed; found \"t3lib_Singleton\", use \"TYPO3\\CMS\\Core\\SingletonInterface\" instead",
"severity": 5,
"source": "Typo3Update.LegacyClassnames.StaticCall.legacyClassname",
"type": "ERROR"
}
],
"warnings": 0
}
},
"totals": {
"errors": 6,
"fixable": 6,
"warnings": 0
}
}

View file

@ -0,0 +1,31 @@
<?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.
*/
Tx_Extbase_Utility_Extension::configurePlugin(
$_EXTKEY,
'name',
['Controller' => 'action']
);
t3lib_div::makeInstance(Tx_Extbase_Command_HelpCommandController::class);
$this->objectManager->get(\Tx_Extbase_Command_HelpCommandController::class);
\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Object\ObjectManager)
->get(\Tx_Extbase_Command_HelpCommandController::class);
is_a($a, t3lib_Singleton::class);

View file

@ -0,0 +1,18 @@
--- tests/Fixtures/Standards/Typo3Update/Sniffs/LegacyClassnames/TypeHintCatchExceptionSniff/InputFileForIssues.php
+++ PHP_CodeSniffer
@@ -21,13 +21,13 @@
try {
// something
-} catch (\Tx_Extbase_Exception $e) {
+} catch (\TYPO3\CMS\Extbase\Exception $e) {
// else
}
try {
// something
-} catch (Tx_Extbase_Exception $e) {
+} catch (\TYPO3\CMS\Extbase\Exception $e) {
// else
}

View file

@ -0,0 +1,33 @@
{
"files": {
"InputFileForIssues.php": {
"errors": 2,
"messages": [
{
"column": 11,
"fixable": true,
"line": 24,
"message": "Legacy classes are not allowed; found \"Tx_Extbase_Exception\", use \"TYPO3\\CMS\\Extbase\\Exception\" instead",
"severity": 5,
"source": "Typo3Update.LegacyClassnames.TypeHintCatchException.legacyClassname",
"type": "ERROR"
},
{
"column": 10,
"fixable": true,
"line": 30,
"message": "Legacy classes are not allowed; found \"Tx_Extbase_Exception\", use \"TYPO3\\CMS\\Extbase\\Exception\" instead",
"severity": 5,
"source": "Typo3Update.LegacyClassnames.TypeHintCatchException.legacyClassname",
"type": "ERROR"
}
],
"warnings": 0
}
},
"totals": {
"errors": 2,
"fixable": 2,
"warnings": 0
}
}

View file

@ -0,0 +1,44 @@
<?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.
*/
try {
// something
} catch (\Tx_Extbase_Exception $e) {
// else
}
try {
// something
} catch (Tx_Extbase_Exception $e) {
// else
}
try {
// something
} catch (\TYPO3\CMS\Extbase\Exception $e) {
// else
}
try {
// something
} catch (TYPO3\CMS\Extbase\Exception $e) {
// else
}

View file

@ -0,0 +1,41 @@
--- tests/Fixtures/Standards/Typo3Update/Sniffs/LegacyClassnames/TypeHintSniff/InputFileForIssues.php
+++ PHP_CodeSniffer
@@ -25,10 +25,10 @@
function something(\TYPO3\CMS\Extbase\Domain\Model\BackendUser $user)
{
}
-function something(\Tx_Extbase_Domain_Model_Backenduser $user)
+function something(\TYPO3\CMS\Extbase\Domain\Model\BackendUser $user)
{
}
-function something(Tx_Extbase_Domain_Model_Backenduser $user)
+function something(\TYPO3\CMS\Extbase\Domain\Model\BackendUser $user)
{
}
@@ -40,10 +40,10 @@
function something(\TYPO3\CMS\Extbase\Domain\Model\BackendUser $user)
{
}
- function something(\Tx_Extbase_Domain_Model_Backenduser $user)
+ function something(\TYPO3\CMS\Extbase\Domain\Model\BackendUser $user)
{
}
- function something(Tx_Extbase_Domain_Model_Backenduser $user)
+ function something(\TYPO3\CMS\Extbase\Domain\Model\BackendUser $user)
{
}
@@ -53,10 +53,10 @@
public function something(\TYPO3\CMS\Extbase\Domain\Model\BackendUser $user)
{
}
- public function something(\Tx_Extbase_Domain_Model_Backenduser $user)
+ public function something(\TYPO3\CMS\Extbase\Domain\Model\BackendUser $user)
{
}
- public function something(Tx_Extbase_Domain_Model_Backenduser $user)
+ public function something(\TYPO3\CMS\Extbase\Domain\Model\BackendUser $user)
{
}
}

View file

@ -0,0 +1,69 @@
{
"files": {
"InputFileForIssues.php": {
"errors": 6,
"messages": [
{
"column": 21,
"fixable": true,
"line": 28,
"message": "Legacy classes are not allowed; found \"Tx_Extbase_Domain_Model_Backenduser\", use \"TYPO3\\CMS\\Extbase\\Domain\\Model\\BackendUser\" instead",
"severity": 5,
"source": "Typo3Update.LegacyClassnames.TypeHint.legacyClassname",
"type": "ERROR"
},
{
"column": 20,
"fixable": true,
"line": 31,
"message": "Legacy classes are not allowed; found \"Tx_Extbase_Domain_Model_Backenduser\", use \"TYPO3\\CMS\\Extbase\\Domain\\Model\\BackendUser\" instead",
"severity": 5,
"source": "Typo3Update.LegacyClassnames.TypeHint.legacyClassname",
"type": "ERROR"
},
{
"column": 25,
"fixable": true,
"line": 43,
"message": "Legacy classes are not allowed; found \"Tx_Extbase_Domain_Model_Backenduser\", use \"TYPO3\\CMS\\Extbase\\Domain\\Model\\BackendUser\" instead",
"severity": 5,
"source": "Typo3Update.LegacyClassnames.TypeHint.legacyClassname",
"type": "ERROR"
},
{
"column": 24,
"fixable": true,
"line": 46,
"message": "Legacy classes are not allowed; found \"Tx_Extbase_Domain_Model_Backenduser\", use \"TYPO3\\CMS\\Extbase\\Domain\\Model\\BackendUser\" instead",
"severity": 5,
"source": "Typo3Update.LegacyClassnames.TypeHint.legacyClassname",
"type": "ERROR"
},
{
"column": 32,
"fixable": true,
"line": 56,
"message": "Legacy classes are not allowed; found \"Tx_Extbase_Domain_Model_Backenduser\", use \"TYPO3\\CMS\\Extbase\\Domain\\Model\\BackendUser\" instead",
"severity": 5,
"source": "Typo3Update.LegacyClassnames.TypeHint.legacyClassname",
"type": "ERROR"
},
{
"column": 31,
"fixable": true,
"line": 59,
"message": "Legacy classes are not allowed; found \"Tx_Extbase_Domain_Model_Backenduser\", use \"TYPO3\\CMS\\Extbase\\Domain\\Model\\BackendUser\" instead",
"severity": 5,
"source": "Typo3Update.LegacyClassnames.TypeHint.legacyClassname",
"type": "ERROR"
}
],
"warnings": 0
}
},
"totals": {
"errors": 6,
"fixable": 6,
"warnings": 0
}
}

View file

@ -0,0 +1,62 @@
<?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.
*/
function something(TYPO3\CMS\Extbase\Domain\Model\BackendUser $user)
{
}
function something(\TYPO3\CMS\Extbase\Domain\Model\BackendUser $user)
{
}
function something(\Tx_Extbase_Domain_Model_Backenduser $user)
{
}
function something(Tx_Extbase_Domain_Model_Backenduser $user)
{
}
class SomeClass
{
function something(TYPO3\CMS\Extbase\Domain\Model\BackendUser $user)
{
}
function something(\TYPO3\CMS\Extbase\Domain\Model\BackendUser $user)
{
}
function something(\Tx_Extbase_Domain_Model_Backenduser $user)
{
}
function something(Tx_Extbase_Domain_Model_Backenduser $user)
{
}
public function something(TYPO3\CMS\Extbase\Domain\Model\BackendUser $user)
{
}
public function something(\TYPO3\CMS\Extbase\Domain\Model\BackendUser $user)
{
}
public function something(\Tx_Extbase_Domain_Model_Backenduser $user)
{
}
public function something(Tx_Extbase_Domain_Model_Backenduser $user)
{
}
}

View file

@ -0,0 +1,13 @@
--- tests/Fixtures/Standards/Typo3Update/Sniffs/LegacyClassnames/UseSniff/InputFileForIssues.php
+++ PHP_CodeSniffer
@@ -19,8 +19,8 @@
* 02110-1301, USA.
*/
-use \Tx_Extbase_Domain_Model_Backenduser;
-use Tx_Extbase_Domain_Model_Backenduser;
+use \TYPO3\CMS\Extbase\Domain\Model\BackendUser;
+use TYPO3\CMS\Extbase\Domain\Model\BackendUser;
use TYPO3\CMS\Extbase\Mvc\Cli\Command;
use \TYPO3\CMS\Extbase\Mvc\Cli\Command;

View file

@ -0,0 +1,33 @@
{
"files": {
"InputFileForIssues.php": {
"errors": 2,
"messages": [
{
"column": 6,
"fixable": true,
"line": 22,
"message": "Legacy classes are not allowed; found \"Tx_Extbase_Domain_Model_Backenduser\", use \"TYPO3\\CMS\\Extbase\\Domain\\Model\\BackendUser\" instead",
"severity": 5,
"source": "Typo3Update.LegacyClassnames.Use.legacyClassname",
"type": "ERROR"
},
{
"column": 5,
"fixable": true,
"line": 23,
"message": "Legacy classes are not allowed; found \"Tx_Extbase_Domain_Model_Backenduser\", use \"TYPO3\\CMS\\Extbase\\Domain\\Model\\BackendUser\" instead",
"severity": 5,
"source": "Typo3Update.LegacyClassnames.Use.legacyClassname",
"type": "ERROR"
}
],
"warnings": 0
}
},
"totals": {
"errors": 2,
"fixable": 2,
"warnings": 0
}
}

View file

@ -0,0 +1,26 @@
<?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.
*/
use \Tx_Extbase_Domain_Model_Backenduser;
use Tx_Extbase_Domain_Model_Backenduser;
use TYPO3\CMS\Extbase\Mvc\Cli\Command;
use \TYPO3\CMS\Extbase\Mvc\Cli\Command;