[TASK] Make Tests/Unit/Tree/ notice free 60/57060/3
authorJan Helke <typo3@helke.de>
Mon, 28 May 2018 11:41:56 +0000 (13:41 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Tue, 29 May 2018 22:05:47 +0000 (00:05 +0200)
Releases: master
Resolves: #85089
Change-Id: Idb85307b51e609f147ccfeacce710256778f96a2
Reviewed-on: https://review.typo3.org/57060
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Tymoteusz Motylewski <t.motylewski@gmail.com>
Tested-by: Tymoteusz Motylewski <t.motylewski@gmail.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/core/Classes/Tree/TableConfiguration/TreeDataProviderFactory.php
typo3/sysext/core/Tests/Unit/Tree/TableConfiguration/TreeDataProviderFactoryTest.php

index be664ed..cab4fb4 100644 (file)
@@ -34,7 +34,7 @@ class TreeDataProviderFactory
     {
         /** @var $dataProvider \TYPO3\CMS\Core\Tree\TableConfiguration\DatabaseTreeDataProvider */
         $dataProvider = null;
-        if (!isset($tcaConfiguration['treeConfig']) | !is_array($tcaConfiguration['treeConfig'])) {
+        if (!isset($tcaConfiguration['treeConfig']) || !is_array($tcaConfiguration['treeConfig'])) {
             throw new \InvalidArgumentException('TCA Tree configuration is invalid: "treeConfig" array is missing', 1288215890);
         }
 
index c4ef6c0..a9d84c7 100644 (file)
@@ -1,4 +1,5 @@
 <?php
+declare(strict_types = 1);
 namespace TYPO3\CMS\Core\Tests\Unit\Tree\TableConfiguration;
 
 /*
@@ -17,23 +18,19 @@ namespace TYPO3\CMS\Core\Tests\Unit\Tree\TableConfiguration;
 use TYPO3\CMS\Core\Tests\Unit\Tree\TableConfiguration\Fixtures\TreeDataProviderFixture;
 use TYPO3\CMS\Core\Tests\Unit\Tree\TableConfiguration\Fixtures\TreeDataProviderWithConfigurationFixture;
 use TYPO3\CMS\Core\Tree\TableConfiguration\TreeDataProviderFactory;
+use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
 
 /**
  * Test case
  */
-class TreeDataProviderFactoryTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
+class TreeDataProviderFactoryTest extends UnitTestCase
 {
     /**
-     * Subject is not notice free, disable E_NOTICES
-     */
-    protected static $suppressNotices = true;
-
-    /**
      * @var TreeDataProviderFactory
      */
     protected $subject;
 
-    protected function setUp()
+    protected function setUp(): void
     {
         $this->subject = new TreeDataProviderFactory();
         $GLOBALS['TCA'] = [];
@@ -46,7 +43,7 @@ class TreeDataProviderFactoryTest extends \TYPO3\TestingFramework\Core\Unit\Unit
     /**
      * @return array
      */
-    public function invalidConfigurationDataProvider()
+    public function invalidConfigurationDataProvider(): array
     {
         return [
             'Empty Configuration' => [[], 1288215890],
@@ -99,22 +96,22 @@ class TreeDataProviderFactoryTest extends \TYPO3\TestingFramework\Core\Unit\Unit
 
     /**
      * @param array $tcaConfiguration
-     * @param string $expectedExceptionCode
+     * @param int $expectedExceptionCode
      * @test
      * @dataProvider invalidConfigurationDataProvider
      */
-    public function factoryThrowsExceptionIfInvalidConfigurationIsGiven(array $tcaConfiguration, $expectedExceptionCode)
+    public function factoryThrowsExceptionIfInvalidConfigurationIsGiven(array $tcaConfiguration, int $expectedExceptionCode): void
     {
         $this->expectException(\InvalidArgumentException::class);
         $this->expectExceptionCode($expectedExceptionCode);
 
-        $this->subject->getDataProvider($tcaConfiguration, 'foo', 'bar', ['uid' => 1]);
+        $this->subject::getDataProvider($tcaConfiguration, 'foo', 'bar', ['uid' => 1]);
     }
 
     /**
      * @test
      */
-    public function configuredDataProviderClassIsInstantiated()
+    public function configuredDataProviderClassIsInstantiated(): void
     {
         $dataProviderMockClassName = TreeDataProviderFixture::class;
 
@@ -122,7 +119,7 @@ class TreeDataProviderFactoryTest extends \TYPO3\TestingFramework\Core\Unit\Unit
             'treeConfig' => ['dataProvider' => $dataProviderMockClassName],
             'internal_type' => 'foo'
         ];
-        $dataProvider = $this->subject->getDataProvider($tcaConfiguration, 'foo', 'bar', ['uid' => 1]);
+        $dataProvider = $this->subject::getDataProvider($tcaConfiguration, 'foo', 'bar', ['uid' => 1]);
 
         $this->assertInstanceOf($dataProviderMockClassName, $dataProvider);
     }
@@ -130,7 +127,7 @@ class TreeDataProviderFactoryTest extends \TYPO3\TestingFramework\Core\Unit\Unit
     /**
      * @test
      */
-    public function configuredDataProviderClassIsInstantiatedWithTcaConfigurationInConstructor()
+    public function configuredDataProviderClassIsInstantiatedWithTcaConfigurationInConstructor(): void
     {
         $dataProviderMockClassName = TreeDataProviderWithConfigurationFixture::class;
 
@@ -142,6 +139,6 @@ class TreeDataProviderFactoryTest extends \TYPO3\TestingFramework\Core\Unit\Unit
         ];
         $this->expectException(\RuntimeException::class);
         $this->expectExceptionCode(1438875249);
-        $this->subject->getDataProvider($tcaConfiguration, 'foo', 'bar', ['uid' => 1]);
+        $this->subject::getDataProvider($tcaConfiguration, 'foo', 'bar', ['uid' => 1]);
     }
 }