FEATURE: Add tests for MissingNamespaceSniff

Relates: #46
This commit is contained in:
Daniel Siepmann 2017-04-06 15:53:03 +02:00
parent 958086da24
commit 65512dcd1d
Signed by: Daniel Siepmann
GPG key ID: 33D6629915560EF4
7 changed files with 94 additions and 1 deletions

View file

@ -0,0 +1,27 @@
<?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.
*/
return [
'defaultVendor' => [],
'customVendor' => [
'runtime-set' => 'vendor MyCustomVendor',
],
];

View file

@ -0,0 +1,16 @@
--- tests/Fixtures/Standards/Typo3Update/Sniffs/LegacyClassnames/MissingNamespaceSniff/customVendor/InputFileForIssues.php
+++ PHP_CodeSniffer
@@ -1,4 +1,5 @@
<?php
+namespace MyCustomVendor\ExtName\Controller;
/*
* Copyright (C) 2017 Daniel Siepmann <coding@daniel-siepmann.de>
@@ -21,6 +22,6 @@
use Tx_Extbase_Mvc_Controller_ActionController;
-class Tx_ExtName_Controller_Frontendcontroller extends Tx_Extbase_Mvc_Controller_ActionController
+class Frontendcontroller extends Tx_Extbase_Mvc_Controller_ActionController
{
}

View file

@ -1,4 +1,4 @@
--- tests/Fixtures/Standards/Typo3Update/Sniffs/LegacyClassnames/MissingNamespaceSniff/InputFileForIssues.php
--- tests/Fixtures/Standards/Typo3Update/Sniffs/LegacyClassnames/MissingNamespaceSniff/defaultVendor/InputFileForIssues.php
+++ PHP_CodeSniffer
@@ -1,4 +1,5 @@
<?php

View file

@ -0,0 +1,24 @@
{
"files": {
"InputFileForIssues.php": {
"errors": 1,
"messages": [
{
"column": 7,
"fixable": true,
"line": 24,
"message": "Legacy class definitions are not allowed; found \"Tx_ExtName_Controller_Frontendcontroller\". Wrap your class inside a namespace.",
"severity": 5,
"source": "Typo3Update.LegacyClassnames.MissingNamespace.legacyClassname",
"type": "ERROR"
}
],
"warnings": 0
}
},
"totals": {
"errors": 1,
"fixable": 1,
"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_Mvc_Controller_ActionController;
class Tx_ExtName_Controller_Frontendcontroller extends Tx_Extbase_Mvc_Controller_ActionController
{
}