From ab65104e1777ff89de6f63d07be1745b8b8b8425 Mon Sep 17 00:00:00 2001
From: Anja Leichsenring <aleichsenring@ab-softlab.de>
Date: Fri, 25 Jul 2014 21:33:02 +0200
Subject: [PATCH] [CLEANUP] Let expected exceptions test for code, not text

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/31835
Reviewed-by: Susanne Moog <typo3@susannemoog.de>
Tested-by: Susanne Moog <typo3@susannemoog.de>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
---
 .../Tests/Unit/Utility/DependencyUtilityTest.php     | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/typo3/sysext/extensionmanager/Tests/Unit/Utility/DependencyUtilityTest.php b/typo3/sysext/extensionmanager/Tests/Unit/Utility/DependencyUtilityTest.php
index 3400c1b29458..208956ccfe5c 100644
--- a/typo3/sysext/extensionmanager/Tests/Unit/Utility/DependencyUtilityTest.php
+++ b/typo3/sysext/extensionmanager/Tests/Unit/Utility/DependencyUtilityTest.php
@@ -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);
 	}
 
-- 
GitLab