[TASK] replaced @expectedException in ext:backend 88/48488/5
authorIan SEBBAGH <ianouf@gmail.com>
Tue, 7 Jun 2016 16:32:33 +0000 (18:32 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Wed, 8 Jun 2016 20:06:32 +0000 (22:06 +0200)
Resolves: #76503
Releases: master
Change-Id: I714ab253a288265c012011f3b1ef3977e859e221
Reviewed-on: https://review.typo3.org/48488
Reviewed-by: Susanne Moog <typo3@susannemoog.de>
Tested-by: Susanne Moog <typo3@susannemoog.de>
Reviewed-by: Frank Naegler <frank.naegler@typo3.org>
Tested-by: Frank Naegler <frank.naegler@typo3.org>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/backend/Tests/Unit/Configuration/TypoScript/ConditionMatching/ConditionMatcherTest.php
typo3/sysext/backend/Tests/Unit/Controller/LoginControllerTest.php
typo3/sysext/backend/Tests/Unit/Form/NodeFactoryTest.php
typo3/sysext/backend/Tests/Unit/Template/Components/Button/SplitButtonTest.php
typo3/sysext/backend/Tests/Unit/View/BackendLayout/BackendLayoutCollectionTest.php
typo3/sysext/backend/Tests/Unit/View/BackendLayout/BackendLayoutTest.php
typo3/sysext/backend/Tests/Unit/View/BackendLayout/DataProviderCollectionTest.php

index 350a2d6..3817520 100755 (executable)
@@ -14,6 +14,7 @@ namespace TYPO3\CMS\Backend\Tests\Unit\Configuration\TypoScript\ConditionMatchin
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Backend\Tests\Unit\Configuration\TypoScript\ConditionMatching\Fixtures\TestConditionException;
 use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 
@@ -943,10 +944,11 @@ class ConditionMatcherTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Backend\Tests\Unit\Configuration\TypoScript\ConditionMatching\Fixtures\TestConditionException
      */
     public function matchCallsTestConditionAndHandsOverParameters()
     {
+        $this->expectException(TestConditionException::class);
+        $this->expectExceptionCode(1411581139);
         $this->matchCondition->match('[TYPO3\\CMS\\Backend\\Tests\\Unit\\Configuration\\TypoScript\\ConditionMatching\\Fixtures\\TestCondition = 7, != 6]');
     }
 }
index 4a22657..4020c6e 100644 (file)
@@ -38,44 +38,44 @@ class LoginControllerTest extends UnitTestCase
 
     /**
      * @test
-     * @expectedException \RuntimeException
-     * @expectedExceptionCode 1433417281
      */
     public function validateAndSortLoginProvidersDetectsMissingProviderConfiguration()
     {
+        $this->expectException(\RuntimeException::class);
+        $this->expectExceptionCode(1433417281);
         unset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['backend']['loginProviders']);
         $this->loginControllerMock->_call('validateAndSortLoginProviders');
     }
 
     /**
      * @test
-     * @expectedException \RuntimeException
-     * @expectedExceptionCode 1433417281
      */
     public function validateAndSortLoginProvidersDetectsNonArrayProviderConfiguration()
     {
+        $this->expectException(\RuntimeException::class);
+        $this->expectExceptionCode(1433417281);
         $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['backend']['loginProviders'] = 'foo';
         $this->loginControllerMock->_call('validateAndSortLoginProviders');
     }
 
     /**
      * @test
-     * @expectedException \RuntimeException
-     * @expectedExceptionCode 1433417281
      */
     public function validateAndSortLoginProvidersDetectsIfNoProviderIsRegistered()
     {
+        $this->expectException(\RuntimeException::class);
+        $this->expectExceptionCode(1433417281);
         $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['backend']['loginProviders'] = [];
         $this->loginControllerMock->_call('validateAndSortLoginProviders');
     }
 
     /**
      * @test
-     * @expectedException \RuntimeException
-     * @expectedExceptionCode 1433416043
      */
     public function validateAndSortLoginProvidersDetectsMissingConfigurationForProvider()
     {
+        $this->expectException(\RuntimeException::class);
+        $this->expectExceptionCode(1433416043);
         $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['backend']['loginProviders'] = [
             1433419736 => []
         ];
@@ -84,11 +84,11 @@ class LoginControllerTest extends UnitTestCase
 
     /**
      * @test
-     * @expectedException \RuntimeException
-     * @expectedExceptionCode 1460977275
      */
     public function validateAndSortLoginProvidersDetectsWrongProvider()
     {
+        $this->expectException(\RuntimeException::class);
+        $this->expectExceptionCode(1460977275);
         $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['backend']['loginProviders'] = [
             1433419736 => [
                 'provider' => \stdClass::class
@@ -99,11 +99,11 @@ class LoginControllerTest extends UnitTestCase
 
     /**
      * @test
-     * @expectedException \RuntimeException
-     * @expectedExceptionCode 1433416044
      */
     public function validateAndSortLoginProvidersDetectsMissingLabel()
     {
+        $this->expectException(\RuntimeException::class);
+        $this->expectExceptionCode(1433416044);
         $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['backend']['loginProviders'] = [
             1433419736 => [
                 'provider' => UsernamePasswordLoginProvider::class,
@@ -116,11 +116,11 @@ class LoginControllerTest extends UnitTestCase
 
     /**
      * @test
-     * @expectedException \RuntimeException
-     * @expectedExceptionCode 1433416045
      */
     public function validateAndSortLoginProvidersDetectsMissingIconClass()
     {
+        $this->expectException(\RuntimeException::class);
+        $this->expectExceptionCode(1433416045);
         $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['backend']['loginProviders'] = [
             1433419736 => [
                 'provider' => UsernamePasswordLoginProvider::class,
@@ -133,11 +133,11 @@ class LoginControllerTest extends UnitTestCase
 
     /**
      * @test
-     * @expectedException \RuntimeException
-     * @expectedExceptionCode 1433416046
      */
     public function validateAndSortLoginProvidersDetectsMissingSorting()
     {
+        $this->expectException(\RuntimeException::class);
+        $this->expectExceptionCode(1433416046);
         $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['backend']['loginProviders'] = [
             1433419736 => [
                 'provider' => UsernamePasswordLoginProvider::class,
index dc1f188..2032efa 100644 (file)
@@ -27,11 +27,11 @@ class NodeFactoryTest extends UnitTestCase
 {
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Backend\Form\Exception
-     * @expectedExceptionCode 1432207533
      */
     public function constructThrowsExceptionIfOverrideMissesNodeNameKey()
     {
+        $this->expectException(\TYPO3\CMS\Backend\Form\Exception::class);
+        $this->expectExceptionCode(1432207533);
         $GLOBALS['TYPO3_CONF_VARS']['SYS']['formEngine']['nodeRegistry'] = array(
             1433089391 => array(
                 'class' => 'foo',
@@ -43,11 +43,11 @@ class NodeFactoryTest extends UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Backend\Form\Exception
-     * @expectedExceptionCode 1432207533
      */
     public function constructThrowsExceptionIfOverrideMissesPriorityKey()
     {
+        $this->expectException(\TYPO3\CMS\Backend\Form\Exception::class);
+        $this->expectExceptionCode(1432207533);
         $GLOBALS['TYPO3_CONF_VARS']['SYS']['formEngine']['nodeRegistry'] = array(
             1433089393 => array(
                 'nodeName' => 'foo',
@@ -59,11 +59,11 @@ class NodeFactoryTest extends UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Backend\Form\Exception
-     * @expectedExceptionCode 1432207533
      */
     public function constructThrowsExceptionIfOverrideMissesClassKey()
     {
+        $this->expectException(\TYPO3\CMS\Backend\Form\Exception::class);
+        $this->expectExceptionCode(1432207533);
         $GLOBALS['TYPO3_CONF_VARS']['SYS']['formEngine']['nodeRegistry'] = array(
             1433089392 => array(
                 'nodeName' => 'foo',
@@ -75,11 +75,11 @@ class NodeFactoryTest extends UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Backend\Form\Exception
-     * @expectedExceptionCode 1432223531
      */
     public function constructThrowsExceptionIfOverridePriorityIsLowerThanZero()
     {
+        $this->expectException(\TYPO3\CMS\Backend\Form\Exception::class);
+        $this->expectExceptionCode(1432223531);
         $GLOBALS['TYPO3_CONF_VARS']['SYS']['formEngine']['nodeRegistry'] = array(
             1433089394 => array(
                 'nodeName' => 'foo',
@@ -91,11 +91,11 @@ class NodeFactoryTest extends UnitTestCase
     }
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Backend\Form\Exception
-     * @expectedExceptionCode 1432223531
      */
     public function constructThrowsExceptionIfOverridePriorityIsHigherThanHundred()
     {
+        $this->expectException(\TYPO3\CMS\Backend\Form\Exception::class);
+        $this->expectExceptionCode(1432223531);
         $GLOBALS['TYPO3_CONF_VARS']['SYS']['formEngine']['nodeRegistry'] = array(
             1433089395 => array(
                 'nodeName' => 'foo',
@@ -108,11 +108,11 @@ class NodeFactoryTest extends UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Backend\Form\Exception
-     * @expectedExceptionCode 1432223893
      */
     public function constructorThrowsExceptionIfOverrideTwoNodesWithSamePriorityAndSameNodeNameAreRegistered()
     {
+        $this->expectException(\TYPO3\CMS\Backend\Form\Exception::class);
+        $this->expectExceptionCode(1432223893);
         $GLOBALS['TYPO3_CONF_VARS']['SYS']['formEngine']['nodeRegistry'] = array(
             1433089396 => array(
                 'nodeName' => 'foo',
@@ -130,11 +130,11 @@ class NodeFactoryTest extends UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Backend\Form\Exception
-     * @expectedExceptionCode 1433155522
      */
     public function constructThrowsExceptionIfResolverMissesNodeNameKey()
     {
+        $this->expectException(\TYPO3\CMS\Backend\Form\Exception::class);
+        $this->expectExceptionCode(1433155522);
         $GLOBALS['TYPO3_CONF_VARS']['SYS']['formEngine']['nodeResolver'] = array(
             1433154905 => array(
                 'class' => 'foo',
@@ -146,11 +146,11 @@ class NodeFactoryTest extends UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Backend\Form\Exception
-     * @expectedExceptionCode 1433155522
      */
     public function constructThrowsExceptionIfResolverMissesPriorityKey()
     {
+        $this->expectException(\TYPO3\CMS\Backend\Form\Exception::class);
+        $this->expectExceptionCode(1433155522);
         $GLOBALS['TYPO3_CONF_VARS']['SYS']['formEngine']['nodeResolver'] = array(
             1433154905 => array(
                 'nodeName' => 'foo',
@@ -162,11 +162,11 @@ class NodeFactoryTest extends UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Backend\Form\Exception
-     * @expectedExceptionCode 1433155522
      */
     public function constructThrowsExceptionIfResolverMissesClassKey()
     {
+        $this->expectException(\TYPO3\CMS\Backend\Form\Exception::class);
+        $this->expectExceptionCode(1433155522);
         $GLOBALS['TYPO3_CONF_VARS']['SYS']['formEngine']['nodeResolver'] = array(
             1433154906 => array(
                 'nodeName' => 'foo',
@@ -178,11 +178,11 @@ class NodeFactoryTest extends UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Backend\Form\Exception
-     * @expectedExceptionCode 1433155563
      */
     public function constructThrowsExceptionIfResolverPriorityIsLowerThanZero()
     {
+        $this->expectException(\TYPO3\CMS\Backend\Form\Exception::class);
+        $this->expectExceptionCode(1433155563);
         $GLOBALS['TYPO3_CONF_VARS']['SYS']['formEngine']['nodeResolver'] = array(
             1433154907 => array(
                 'nodeName' => 'foo',
@@ -194,11 +194,11 @@ class NodeFactoryTest extends UnitTestCase
     }
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Backend\Form\Exception
-     * @expectedExceptionCode 1433155563
      */
     public function constructThrowsExceptionIfResolverPriorityIsHigherThanHundred()
     {
+        $this->expectException(\TYPO3\CMS\Backend\Form\Exception::class);
+        $this->expectExceptionCode(1433155563);
         $GLOBALS['TYPO3_CONF_VARS']['SYS']['formEngine']['nodeResolver'] = array(
             1433154908 => array(
                 'nodeName' => 'foo',
@@ -211,11 +211,11 @@ class NodeFactoryTest extends UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Backend\Form\Exception
-     * @expectedExceptionCode 1433155705
      */
     public function constructorThrowsExceptionIfResolverTwoNodesWithSamePriorityAndSameNodeNameAreRegistered()
     {
+        $this->expectException(\TYPO3\CMS\Backend\Form\Exception::class);
+        $this->expectExceptionCode(1433155705);
         $GLOBALS['TYPO3_CONF_VARS']['SYS']['formEngine']['nodeResolver'] = array(
             1433154909 => array(
                 'nodeName' => 'foo',
@@ -253,22 +253,22 @@ class NodeFactoryTest extends UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Backend\Form\Exception
-     * @expectedExceptionCode 1431452406
      */
     public function createThrowsExceptionIfRenderTypeIsNotGiven()
     {
+        $this->expectException(\TYPO3\CMS\Backend\Form\Exception::class);
+        $this->expectExceptionCode(1431452406);
         $subject = new NodeFactory();
         $subject->create(array());
     }
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Backend\Form\Exception
-     * @expectedExceptionCode 1431872546
      */
     public function createThrowsExceptionIfNodeDoesNotImplementNodeInterface()
     {
+        $this->expectException(\TYPO3\CMS\Backend\Form\Exception::class);
+        $this->expectExceptionCode(1431872546);
         $mockNode = new \stdClass();
         /** @var NodeFactory|\PHPUnit_Framework_MockObject_MockObject $mockSubject */
         $mockSubject = $this->getMock(NodeFactory::class, array('instantiate'), array(), '', false);
@@ -390,11 +390,11 @@ class NodeFactoryTest extends UnitTestCase
 
     /**
      * @test
-     * @expectedException \TYPO3\CMS\Backend\Form\Exception
-     * @expectedExceptionCode 1433157422
      */
     public function createThrowsExceptionIfResolverDoesNotImplementNodeResolverInterface()
     {
+        $this->expectException(\TYPO3\CMS\Backend\Form\Exception::class);
+        $this->expectExceptionCode(1433157422);
         $data = array('renderType' => 'foo');
         $GLOBALS['TYPO3_CONF_VARS']['SYS']['formEngine']['nodeResolver'] = array(
             1433156887 => array(
index dff3ec3..539fe1d 100644 (file)
@@ -41,12 +41,12 @@ class SplitButtonTest extends UnitTestCase
      * Try adding an invalid button to a splitButton
      *
      * @test
-     * @expectedException \InvalidArgumentException
-     * @expectedExceptionCode 1441706330
      * @return void
      */
     public function isButtonValidInvalidButtonGivenExpectFalse()
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1441706330);
         $button = new SplitButton();
 
         $primaryAction = new LinkButton();
@@ -60,12 +60,12 @@ class SplitButtonTest extends UnitTestCase
      * Try to add multiple primary actions
      *
      * @test
-     * @expectedException \InvalidArgumentException
-     * @expectedExceptionCode 1441706340
      * @return void
      */
     public function isButtonValidBrokenSetupMultiplePrimaryActionsGivenExpectFalse()
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1441706340);
         $button = new SplitButton();
 
         $primaryAction = new LinkButton();
@@ -85,12 +85,12 @@ class SplitButtonTest extends UnitTestCase
      * Try to add an invalid button as second parameter
      *
      * @test
-     * @expectedException \InvalidArgumentException
-     * @expectedExceptionCode 1441706330
      * @return void
      */
     public function isButtonValidBrokenSetupInvalidButtonAsSecondParametersGivenExpectFalse()
     {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1441706330);
         $button = new SplitButton();
 
         $primaryAction = new LinkButton();
index 6d0eb07..202ceb6 100644 (file)
@@ -21,10 +21,11 @@ class BackendLayoutCollectionTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 {
     /**
      * @test
-     * @expectedException \UnexpectedValueException
      */
     public function invalidIdentifierIsRecognizedOnCreation()
     {
+        $this->expectException(\UnexpectedValueException::class);
+        $this->expectExceptionCode(1381597631);
         $identifier = $this->getUniqueId('identifier__');
         new \TYPO3\CMS\Backend\View\BackendLayout\BackendLayoutCollection($identifier);
     }
@@ -42,10 +43,11 @@ class BackendLayoutCollectionTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \UnexpectedValueException
      */
     public function invalidBackendLayoutIsRecognizedOnAdding()
     {
+        $this->expectException(\UnexpectedValueException::class);
+        $this->expectExceptionCode(1381597628);
         $identifier = $this->getUniqueId('identifier');
         $backendLayoutCollection = new \TYPO3\CMS\Backend\View\BackendLayout\BackendLayoutCollection($identifier);
         $backendLayoutIdentifier = $this->getUniqueId('identifier__');
@@ -57,10 +59,11 @@ class BackendLayoutCollectionTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \LogicException
      */
     public function duplicateBackendLayoutIsRecognizedOnAdding()
     {
+        $this->expectException(\LogicException::class);
+        $this->expectExceptionCode(1381559376);
         $identifier = $this->getUniqueId('identifier');
         $backendLayoutCollection = new \TYPO3\CMS\Backend\View\BackendLayout\BackendLayoutCollection($identifier);
         $backendLayoutIdentifier = $this->getUniqueId('identifier');
index cd393d3..0493e24 100644 (file)
@@ -21,10 +21,11 @@ class BackendLayoutTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 {
     /**
      * @test
-     * @expectedException \UnexpectedValueException
      */
     public function invalidIdentifierIsRecognizedOnCreation()
     {
+        $this->expectException(\UnexpectedValueException::class);
+        $this->expectExceptionCode(1381597630);
         $identifier = $this->getUniqueId('identifier__');
         $title = $this->getUniqueId('title');
         $configuration = $this->getUniqueId('configuration');
index cbb4a5f..9565e4e 100644 (file)
@@ -34,10 +34,11 @@ class DataProviderCollectionTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \UnexpectedValueException
      */
     public function invalidIdentifierIsRecognizedOnAdding()
     {
+        $this->expectException(\UnexpectedValueException::class);
+        $this->expectExceptionCode(1381597629);
         $identifier = $this->getUniqueId('identifier__');
         $dataProviderMock = $this->getMock('stdClass');
 
@@ -46,10 +47,11 @@ class DataProviderCollectionTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     /**
      * @test
-     * @expectedException \LogicException
      */
     public function invalidInterfaceIsRecognizedOnAdding()
     {
+        $this->expectException(\LogicException::class);
+        $this->expectExceptionCode(1381269811);
         $identifier = $this->getUniqueId('identifier');
         $dataProviderMock = $this->getMock('stdClass');