[TASK] Deprecate AbstractValidatorTestcase 98/55298/3
authorAlexander Schnitzler <git@alexanderschnitzler.de>
Mon, 8 Jan 2018 20:13:33 +0000 (21:13 +0100)
committerWouter Wolters <typo3@wouterwolters.nl>
Mon, 8 Jan 2018 21:04:56 +0000 (22:04 +0100)
The class implemented logic to presumably make
testing validators more easy. However, a decision
on more atomic tests has been made and therefore
that abstract test case has been deprecated and
will be removed in the future.

Releases: master
Resolves: #83511
Change-Id: Ic7f071c370acec53d466326344d34ce1334276b4
Reviewed-on: https://review.typo3.org/55298
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
typo3/sysext/core/Documentation/Changelog/master/Deprecation-83511-DeprecateAbstractValidatorTestcase.rst [new file with mode: 0644]
typo3/sysext/extbase/Tests/Unit/Validation/Validator/AbstractValidatorTestcase.php
typo3/sysext/extbase/Tests/Unit/Validation/Validator/BooleanValidatorTest.php
typo3/sysext/install/Configuration/ExtensionScanner/Php/ClassNameMatcher.php

diff --git a/typo3/sysext/core/Documentation/Changelog/master/Deprecation-83511-DeprecateAbstractValidatorTestcase.rst b/typo3/sysext/core/Documentation/Changelog/master/Deprecation-83511-DeprecateAbstractValidatorTestcase.rst
new file mode 100644 (file)
index 0000000..31e5ab7
--- /dev/null
@@ -0,0 +1,32 @@
+.. include:: ../../Includes.txt
+
+=========================================================
+Deprecation: #83511 - Deprecate AbstractValidatorTestcase
+=========================================================
+
+See :issue:`83511`
+
+Description
+===========
+
+The class AbstractValidatorTestcase is deprecated and will be removed in TYPO3 version 10.0.
+
+
+Impact
+======
+
+Test cases for validators that extend that class will no longer work.
+
+
+Affected Installations
+======================
+
+All installations that make use of that class
+
+
+Migration
+=========
+
+Put the logic of that test case into your own test cases.
+
+.. index:: PHP-API, PartiallyScanned
index a95c9d8..4397531 100644 (file)
@@ -23,6 +23,7 @@ namespace TYPO3\CMS\Extbase\Tests\Unit\Validation\Validator;
 
 /**
  * Test case for the Abstract Validator
+ * @deprecated
  */
 abstract class AbstractValidatorTestcase extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
 {
@@ -36,6 +37,9 @@ abstract class AbstractValidatorTestcase extends \TYPO3\TestingFramework\Core\Un
      */
     protected $validator;
 
+    /**
+     * @deprecated
+     */
     protected function setUp()
     {
         $this->validator = $this->getValidator();
@@ -44,18 +48,30 @@ abstract class AbstractValidatorTestcase extends \TYPO3\TestingFramework\Core\Un
     /**
      * @param array $options
      * @return mixed
+     * @deprecated
      */
     protected function getValidator($options = [])
     {
+        trigger_error(
+            __CLASS__ . ' is deprecated and will be removed in TYPO3 v10.0.',
+            E_USER_DEPRECATED
+        );
+
         $validator = new $this->validatorClassName($options);
         return $validator;
     }
 
     /**
      * @param array $options
+     * @deprecated
      */
     protected function validatorOptions($options)
     {
+        trigger_error(
+            __CLASS__ . ' is deprecated and will be removed in TYPO3 v10.0.',
+            E_USER_DEPRECATED
+        );
+
         $this->validator = $this->getValidator($options);
     }
 }
index 447f03c..0261a0b 100644 (file)
@@ -1,4 +1,5 @@
 <?php
+declare(strict_types=1);
 namespace TYPO3\CMS\Extbase\Tests\Unit\Validation\Validator;
 
 /*                                                                        *
@@ -21,25 +22,20 @@ namespace TYPO3\CMS\Extbase\Tests\Unit\Validation\Validator;
  * The TYPO3 project - inspiring people to share!                         *
  *                                                                        */
 
+use TYPO3\CMS\Extbase\Validation\Validator\BooleanValidator;
+
 /**
- * Testcase for the number range validator
- *
- * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
+ * Testcase
  */
-class BooleanValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\Validation\Validator\AbstractValidatorTestcase
+class BooleanValidatorTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
 {
     /**
-     * @var string
-     */
-    protected $validatorClassName = \TYPO3\CMS\Extbase\Validation\Validator\BooleanValidator::class;
-
-    /**
      * @test
      */
     public function booleanValidatorReturnsNoErrorForAFalseStringExpectation()
     {
         $options = ['is' => 'false'];
-        $validator = $this->getMockBuilder($this->validatorClassName)
+        $validator = $this->getMockBuilder(BooleanValidator::class)
             ->setMethods(['translateErrorMessage'])
             ->setConstructorArgs([$options])
             ->getMock();
@@ -52,7 +48,7 @@ class BooleanValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\Validation\Vali
     public function booleanValidatorReturnsNoErrorForATrueStringExpectation()
     {
         $options = ['is' => 'true'];
-        $validator = $this->getMockBuilder($this->validatorClassName)
+        $validator = $this->getMockBuilder(BooleanValidator::class)
             ->setMethods(['translateErrorMessage'])
             ->setConstructorArgs([$options])
             ->getMock();
@@ -65,7 +61,7 @@ class BooleanValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\Validation\Vali
     public function booleanValidatorReturnsNoErrorForATrueExpectation()
     {
         $options = ['is' => true];
-        $validator = $this->getMockBuilder($this->validatorClassName)
+        $validator = $this->getMockBuilder(BooleanValidator::class)
             ->setMethods(['translateErrorMessage'])
             ->setConstructorArgs([$options])
             ->getMock();
@@ -78,7 +74,7 @@ class BooleanValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\Validation\Vali
     public function booleanValidatorReturnsNoErrorForAFalseExpectation()
     {
         $options = ['is' => false];
-        $validator = $this->getMockBuilder($this->validatorClassName)
+        $validator = $this->getMockBuilder(BooleanValidator::class)
             ->setMethods(['translateErrorMessage'])
             ->setConstructorArgs([$options])
             ->getMock();
@@ -91,7 +87,7 @@ class BooleanValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\Validation\Vali
     public function booleanValidatorReturnsErrorForTrueWhenFalseExpected()
     {
         $options = ['is' => false];
-        $validator = $this->getMockBuilder($this->validatorClassName)
+        $validator = $this->getMockBuilder(BooleanValidator::class)
             ->setMethods(['translateErrorMessage'])
             ->setConstructorArgs([$options])
             ->getMock();
@@ -104,7 +100,7 @@ class BooleanValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\Validation\Vali
     public function booleanValidatorReturnsErrorForFalseWhenTrueExpected()
     {
         $options = ['is' => true];
-        $validator = $this->getMockBuilder($this->validatorClassName)
+        $validator = $this->getMockBuilder(BooleanValidator::class)
             ->setMethods(['translateErrorMessage'])
             ->setConstructorArgs([$options])
             ->getMock();
@@ -117,7 +113,7 @@ class BooleanValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\Validation\Vali
     public function booleanValidatorReturnsErrorForAString()
     {
         $options = ['is' => true];
-        $validator = $this->getMockBuilder($this->validatorClassName)
+        $validator = $this->getMockBuilder(BooleanValidator::class)
             ->setMethods(['translateErrorMessage'])
             ->setConstructorArgs([$options])
             ->getMock();
@@ -130,7 +126,7 @@ class BooleanValidatorTest extends \TYPO3\CMS\Extbase\Tests\Unit\Validation\Vali
     public function booleanValidatorReturnsTrueIfNoParameterIsGiven()
     {
         $options = [];
-        $validator = $this->getMockBuilder($this->validatorClassName)
+        $validator = $this->getMockBuilder(BooleanValidator::class)
             ->setMethods(['translateErrorMessage'])
             ->setConstructorArgs([$options])
             ->getMock();
index 921b6f6..7d4deba 100644 (file)
@@ -529,4 +529,9 @@ return [
             'Deprecation-83503-DeprecateUnneededRawValidator.rst',
         ],
     ],
+    'TYPO3\CMS\Extbase\Tests\Unit\Validation\Validator\AbstractValidatorTestcase' => [
+        'restFiles' => [
+            'Deprecation-83511-DeprecateAbstractValidatorTestcase.rst',
+        ],
+    ],
 ];