[CLEANUP] Let expected exceptions test for code, not text 36/31836/2
authorAnja Leichsenring <aleichsenring@ab-softlab.de>
Fri, 25 Jul 2014 19:33:02 +0000 (21:33 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Fri, 25 Jul 2014 19:53:52 +0000 (21:53 +0200)
When an exception is expected in DependencyUtilityTest, the correct
exception is tested by text. The change of wording of some of those
exceptions caused the related test to fail.

Testing for the exception code instead of the text opens the
possibility to adapt display messages, while the exception code stays
unchanged and stabilizes tests against false positives.

Change-Id: Ib1365c8d7166e522690bb9f8842adc8eb27f635b
Resolves: #60583
Relates: #53572
Releases: 6.3, 6.2
Reviewed-on: http://review.typo3.org/31836
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/extensionmanager/Tests/Unit/Utility/DependencyUtilityTest.php

index 3400c1b..208956c 100644 (file)
@@ -43,7 +43,7 @@ class DependencyUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                $dependencyMock->setIdentifier('typo3');
                $dependencyUtility = $this->getAccessibleMock('TYPO3\\CMS\\Extensionmanager\\Utility\\DependencyUtility', array('dummy'));
 
-               $this->setExpectedException('TYPO3\\CMS\\Extensionmanager\\Exception\\ExtensionManagerException', 'Your TYPO3 version is lower than necessary. You need at least TYPO3 version 15.0.0');
+               $this->setExpectedException('TYPO3\\CMS\\Extensionmanager\\Exception\\ExtensionManagerException','', 1399144499);
                $dependencyUtility->_call('checkTypo3Dependency', $dependencyMock);
        }
 
@@ -59,7 +59,7 @@ class DependencyUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                $dependencyMock->setIdentifier('typo3');
                $dependencyUtility = $this->getAccessibleMock('TYPO3\\CMS\\Extensionmanager\\Utility\\DependencyUtility', array('dummy'));
 
-               $this->setExpectedException('TYPO3\\CMS\\Extensionmanager\\Exception\\ExtensionManagerException', 'Your TYPO3 version is higher than allowed. You can use TYPO3 versions 1.0.0 - 3.0.0');
+               $this->setExpectedException('TYPO3\\CMS\\Extensionmanager\\Exception\\ExtensionManagerException', '', 1399144521);
                $dependencyUtility->_call('checkTypo3Dependency', $dependencyMock);
        }
 
@@ -73,7 +73,7 @@ class DependencyUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                $dependencyMock->setIdentifier('123');
                $dependencyUtility = $this->getAccessibleMock('TYPO3\\CMS\\Extensionmanager\\Utility\\DependencyUtility', array('dummy'));
 
-               $this->setExpectedException('TYPO3\\CMS\\Extensionmanager\\Exception\\ExtensionManagerException', 'checkTypo3Dependency can only check TYPO3 dependencies. Found dependency with identifier "123"');
+               $this->setExpectedException('TYPO3\\CMS\\Extensionmanager\\Exception\\ExtensionManagerException', '', 1399144551);
                $dependencyUtility->_call('checkTypo3Dependency', $dependencyMock);
        }
 
@@ -133,7 +133,7 @@ class DependencyUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                $dependencyMock->setIdentifier('php');
                $dependencyUtility = $this->getAccessibleMock('TYPO3\\CMS\\Extensionmanager\\Utility\\DependencyUtility', array('dummy'));
 
-               $this->setExpectedException('TYPO3\\CMS\\Extensionmanager\\Exception\\ExtensionManagerException', 'Your PHP version is lower than necessary. You need at least PHP version 15.0.0');
+               $this->setExpectedException('TYPO3\\CMS\\Extensionmanager\\Exception\\ExtensionManagerException', '', 1377977857);
                $dependencyUtility->_call('checkPhpDependency', $dependencyMock);
        }
 
@@ -149,7 +149,7 @@ class DependencyUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                $dependencyMock->setIdentifier('php');
                $dependencyUtility = $this->getAccessibleMock('TYPO3\\CMS\\Extensionmanager\\Utility\\DependencyUtility', array('dummy'));
 
-               $this->setExpectedException('TYPO3\\CMS\\Extensionmanager\\Exception\\ExtensionManagerException', 'Your PHP version is higher than allowed. You can use PHP versions 1.0.0 - 3.0.0');
+               $this->setExpectedException('TYPO3\\CMS\\Extensionmanager\\Exception\\ExtensionManagerException', '', 1377977856);
                $dependencyUtility->_call('checkPhpDependency', $dependencyMock);
        }
 
@@ -163,7 +163,7 @@ class DependencyUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                $dependencyMock->setIdentifier('123');
                $dependencyUtility = $this->getAccessibleMock('TYPO3\\CMS\\Extensionmanager\\Utility\\DependencyUtility', array('dummy'));
 
-               $this->setExpectedException('TYPO3\\CMS\\Extensionmanager\\Exception\\ExtensionManagerException', 'checkPhpDependency can only check PHP dependencies. Found dependency with identifier "123"');
+               $this->setExpectedException('TYPO3\\CMS\\Extensionmanager\\Exception\\ExtensionManagerException', '', 1377977858);
                $dependencyUtility->_call('checkPhpDependency', $dependencyMock);
        }