Skip to content

Commit

Permalink
[TASK] Make UnitDeprecated/ notice free
Browse files Browse the repository at this point in the history
Releases: master
Resolves: #85097
Change-Id: I1eb8cb056350badf057e58fe4c0d5c22b3568133
Reviewed-on: https://review.typo3.org/57068
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Tymoteusz Motylewski <t.motylewski@gmail.com>
Tested-by: Tymoteusz Motylewski <t.motylewski@gmail.com>
  • Loading branch information
lolli42 authored and tmotyl committed Jun 15, 2018
1 parent 4c0f3aa commit ff5145b
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 64 deletions.
21 changes: 10 additions & 11 deletions typo3/sysext/core/Tests/UnitDeprecated/Html/RteHtmlParserTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php
namespace TYPO3\CMS\Core\Tests\Unit_Deprecated\Html;
declare(strict_types = 1);
namespace TYPO3\CMS\Core\Tests\UnitDeprecated\Html;

/*
* This file is part of the TYPO3 CMS project.
Expand All @@ -14,6 +15,7 @@
* The TYPO3 project - inspiring people to share!
*/

use TYPO3\CMS\Core\Html\RteHtmlParser;
use TYPO3\TestingFramework\Core\Unit\UnitTestCase;

/**
Expand All @@ -27,18 +29,13 @@ class RteHtmlParserTest extends UnitTestCase
protected $resetSingletonInstances = true;

/**
* Subject is not notice free, disable E_NOTICES
*/
protected static $suppressNotices = true;

/**
* @var \TYPO3\CMS\Core\Html\RteHtmlParser
* @var RteHtmlParser
*/
protected $subject = null;

protected function setUp()
protected function setUp(): void
{
$this->subject = new \TYPO3\CMS\Core\Html\RteHtmlParser();
$this->subject = new RteHtmlParser();
$this->subject->procOptions = [
'allowTagsOutside' => 'hr, address',
'overruleMode' => 'default'
Expand All @@ -48,7 +45,7 @@ protected function setUp()
/**
* Data provider for linkWithAtSignCorrectlyTransformedOnWayToRTE
*/
public static function linkWithAtSignCorrectlyTransformedOnWayToRTEProvider()
public static function linkWithAtSignCorrectlyTransformedOnWayToRTEProvider(): array
{
return [
'external url with @ sign' => [
Expand All @@ -65,8 +62,10 @@ public static function linkWithAtSignCorrectlyTransformedOnWayToRTEProvider()
/**
* @test
* @dataProvider linkWithAtSignCorrectlyTransformedOnWayToRTEProvider
* @param $content
* @param $expectedResult
*/
public function linkWithAtSignCorrectlyTransformedOnWayToRTE($content, $expectedResult)
public function linkWithAtSignCorrectlyTransformedOnWayToRTE(string $content, string $expectedResult): void
{
$thisConfig = ['proc.' => $this->subject->procOptions];
$this->assertEquals($expectedResult, $this->subject->RTE_transform($content, [], 'rte', $thisConfig));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php
namespace TYPO3\CMS\Core\Tests\Unit\Utility;
declare(strict_types = 1);
namespace TYPO3\CMS\Core\Tests\UnitDeprecated\Utility;

/*
* This file is part of the TYPO3 CMS project.
Expand All @@ -14,16 +15,14 @@
* The TYPO3 project - inspiring people to share!
*/

use TYPO3\CMS\Core\Utility\ClientUtility;
use TYPO3\TestingFramework\Core\Unit\UnitTestCase;

/**
* Testcase for the \TYPO3\CMS\Core\Utility\ClientUtility class.
*/
class ClientUtilityTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
class ClientUtilityTest extends UnitTestCase
{
/**
* Subject is not notice free, disable E_NOTICES
*/
protected static $suppressNotices = true;

//////////////////////////////////////////////////////////
// Utility Functions
//////////////////////////////////////////////////////////
Expand All @@ -37,11 +36,12 @@ private function analyzeUserAgentStrings($browserStrings, $expectedMembers)
{
$actual = $expected = [];
foreach ($browserStrings as $browserString) {
$infoArray = \TYPO3\CMS\Core\Utility\ClientUtility::getBrowserInfo($browserString);
$infoArray = ClientUtility::getBrowserInfo($browserString);
$expected[] = $expectedMembers;
$explodedVersion = explode('.', $infoArray['version']);
$actual[] = [
'browser' => $infoArray['browser'],
'version' => array_shift(explode('.', $infoArray['version']))
'version' => array_shift($explodedVersion)
];
}
$this->assertSame($expected, $actual);
Expand Down Expand Up @@ -208,7 +208,7 @@ public function checkBrowserInfoIE11()
public function checkGeckoVersion()
{
$userAgentString = 'Mozilla/5.0 (Windows; U; Windows NT 6.0; de; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3';
$infoArray = \TYPO3\CMS\Core\Utility\ClientUtility::getBrowserInfo($userAgentString);
$infoArray = ClientUtility::getBrowserInfo($userAgentString);
$this->assertEquals('1.9.2.3', $infoArray['all']['gecko']);
}

Expand All @@ -218,7 +218,7 @@ public function checkGeckoVersion()
public function getBrowserInfoReturnsCorrectSystemValueForUserAgentStringOfWindows8()
{
$userAgentString = 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0)';
$infoArray = \TYPO3\CMS\Core\Utility\ClientUtility::getBrowserInfo($userAgentString);
$infoArray = ClientUtility::getBrowserInfo($userAgentString);
$this->assertContains('win8', $infoArray['all_systems']);
}

Expand All @@ -228,7 +228,7 @@ public function getBrowserInfoReturnsCorrectSystemValueForUserAgentStringOfWindo
public function getBrowserInfoReturnsCorrectSystemValueForUserAgentStringOfWindows8rev1()
{
$userAgentString = 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.3; Trident/6.0)';
$infoArray = \TYPO3\CMS\Core\Utility\ClientUtility::getBrowserInfo($userAgentString);
$infoArray = ClientUtility::getBrowserInfo($userAgentString);
$this->assertContains('win8', $infoArray['all_systems']);
}

Expand All @@ -238,7 +238,7 @@ public function getBrowserInfoReturnsCorrectSystemValueForUserAgentStringOfWindo
public function getBrowserInfoReturnsCorrectSystemValueForUserAgentStringOfWindows7()
{
$userAgentString = 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0)';
$infoArray = \TYPO3\CMS\Core\Utility\ClientUtility::getBrowserInfo($userAgentString);
$infoArray = ClientUtility::getBrowserInfo($userAgentString);
$this->assertContains('win7', $infoArray['all_systems']);
}

Expand All @@ -248,7 +248,7 @@ public function getBrowserInfoReturnsCorrectSystemValueForUserAgentStringOfWindo
public function getBrowserInfoReturnsCorrectSystemValueForUserAgentStringOfWindowsVista()
{
$userAgentString = 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.0.04506)';
$infoArray = \TYPO3\CMS\Core\Utility\ClientUtility::getBrowserInfo($userAgentString);
$infoArray = ClientUtility::getBrowserInfo($userAgentString);
$this->assertContains('winVista', $infoArray['all_systems']);
}

Expand All @@ -258,7 +258,7 @@ public function getBrowserInfoReturnsCorrectSystemValueForUserAgentStringOfWindo
public function getBrowserInfoReturnsCorrectSystemValueForUserAgentStringOfWindowsXp()
{
$userAgentString = 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0)';
$infoArray = \TYPO3\CMS\Core\Utility\ClientUtility::getBrowserInfo($userAgentString);
$infoArray = ClientUtility::getBrowserInfo($userAgentString);
$this->assertContains('winXP', $infoArray['all_systems']);
}

Expand All @@ -268,7 +268,7 @@ public function getBrowserInfoReturnsCorrectSystemValueForUserAgentStringOfWindo
public function getBrowserInfoReturnsCorrectSystemValueForUserAgentStringOfWindows2k()
{
$userAgentString = 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; SV1)';
$infoArray = \TYPO3\CMS\Core\Utility\ClientUtility::getBrowserInfo($userAgentString);
$infoArray = ClientUtility::getBrowserInfo($userAgentString);
$this->assertContains('win2k', $infoArray['all_systems']);
}

Expand All @@ -278,7 +278,7 @@ public function getBrowserInfoReturnsCorrectSystemValueForUserAgentStringOfWindo
public function getBrowserInfoReturnsCorrectSystemValueForUserAgentStringOfWindows2kServicePack1()
{
$userAgentString = 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.01; SV1)';
$infoArray = \TYPO3\CMS\Core\Utility\ClientUtility::getBrowserInfo($userAgentString);
$infoArray = ClientUtility::getBrowserInfo($userAgentString);
$this->assertContains('win2k', $infoArray['all_systems']);
}

Expand All @@ -288,7 +288,7 @@ public function getBrowserInfoReturnsCorrectSystemValueForUserAgentStringOfWindo
public function getBrowserInfoReturnsCorrectSystemValueForUserAgentStringOfWindowsNt()
{
$userAgentString = 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 4.0)';
$infoArray = \TYPO3\CMS\Core\Utility\ClientUtility::getBrowserInfo($userAgentString);
$infoArray = ClientUtility::getBrowserInfo($userAgentString);
$this->assertContains('winNT', $infoArray['all_systems']);
}

Expand All @@ -298,7 +298,7 @@ public function getBrowserInfoReturnsCorrectSystemValueForUserAgentStringOfWindo
public function getBrowserInfoReturnsCorrectSystemValueForUserAgentStringOfIpad()
{
$userAgentString = 'Mozilla/5.0 (iPad; U; CPU OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7W367a Safari/531.21.10';
$infoArray = \TYPO3\CMS\Core\Utility\ClientUtility::getBrowserInfo($userAgentString);
$infoArray = ClientUtility::getBrowserInfo($userAgentString);
$this->assertContains('iOS', $infoArray['all_systems']);
}

Expand All @@ -308,7 +308,7 @@ public function getBrowserInfoReturnsCorrectSystemValueForUserAgentStringOfIpad(
public function getBrowserInfoReturnsCorrectSystemValueForUserAgentStringOfIphone()
{
$userAgentString = 'Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_0 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8A293 Safari/6531.22.7';
$infoArray = \TYPO3\CMS\Core\Utility\ClientUtility::getBrowserInfo($userAgentString);
$infoArray = ClientUtility::getBrowserInfo($userAgentString);
$this->assertContains('iOS', $infoArray['all_systems']);
}

Expand All @@ -318,7 +318,7 @@ public function getBrowserInfoReturnsCorrectSystemValueForUserAgentStringOfIphon
public function getBrowserInfoReturnsCorrectSystemValueForUserAgentStringOfIpod()
{
$userAgentString = 'Mozilla/5.0 (iPod; U; CPU like Mac OS X; en) AppleWebKit/420.1 (KHTML, like Geckto) Version/3.0 Mobile/3A101a Safari/419.3';
$infoArray = \TYPO3\CMS\Core\Utility\ClientUtility::getBrowserInfo($userAgentString);
$infoArray = ClientUtility::getBrowserInfo($userAgentString);
$this->assertContains('iOS', $infoArray['all_systems']);
}

Expand All @@ -328,7 +328,7 @@ public function getBrowserInfoReturnsCorrectSystemValueForUserAgentStringOfIpod(
public function getBrowserInfoReturnsCorrectSystemValueForUserAgentStringOfMacOsX()
{
$userAgentString = 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_5; en-us) AppleWebKit/534.15+ (KHTML, like Gecko) Version/5.0.3 Safari/533.19.4';
$infoArray = \TYPO3\CMS\Core\Utility\ClientUtility::getBrowserInfo($userAgentString);
$infoArray = ClientUtility::getBrowserInfo($userAgentString);
$this->assertContains('mac', $infoArray['all_systems']);
}

Expand All @@ -338,7 +338,7 @@ public function getBrowserInfoReturnsCorrectSystemValueForUserAgentStringOfMacOs
public function getBrowserInfoReturnsCorrectSystemValueForUserAgentStringOfLinux()
{
$userAgentString = 'Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.8) Gecko/20100723 Ubuntu/10.04 (lucid) Firefox/3.6.8';
$infoArray = \TYPO3\CMS\Core\Utility\ClientUtility::getBrowserInfo($userAgentString);
$infoArray = ClientUtility::getBrowserInfo($userAgentString);
$this->assertContains('linux', $infoArray['all_systems']);
}

Expand All @@ -348,7 +348,7 @@ public function getBrowserInfoReturnsCorrectSystemValueForUserAgentStringOfLinux
public function getBrowserInfoReturnsCorrectSystemValueForUserAgentStringOfSolaris()
{
$userAgentString = 'Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:1.9.1.9) Gecko/20100525 Firefox/3.5.9';
$infoArray = \TYPO3\CMS\Core\Utility\ClientUtility::getBrowserInfo($userAgentString);
$infoArray = ClientUtility::getBrowserInfo($userAgentString);
$this->assertContains('unix_sun', $infoArray['all_systems']);
}

Expand Down Expand Up @@ -377,7 +377,7 @@ public static function androidUserAgentsProvider()
*/
public function getBrowserInfoReturnsCorrectSystemValueForUserAgentStringOfAndroid($userAgentString)
{
$infoArray = \TYPO3\CMS\Core\Utility\ClientUtility::getBrowserInfo($userAgentString);
$infoArray = ClientUtility::getBrowserInfo($userAgentString);
$this->assertContains('android', $infoArray['all_systems']);
}

Expand All @@ -387,7 +387,7 @@ public function getBrowserInfoReturnsCorrectSystemValueForUserAgentStringOfAndro
public function getBrowserInfoReturnsCorrectSystemValueForUserAgentStringOfOpenbsd()
{
$userAgentString = 'Links (1.00pre20; OpenBSD 4.8 i386; 80x25)';
$infoArray = \TYPO3\CMS\Core\Utility\ClientUtility::getBrowserInfo($userAgentString);
$infoArray = ClientUtility::getBrowserInfo($userAgentString);
$this->assertContains('unix_bsd', $infoArray['all_systems']);
}

Expand All @@ -397,7 +397,7 @@ public function getBrowserInfoReturnsCorrectSystemValueForUserAgentStringOfOpenb
public function getBrowserInfoReturnsCorrectSystemValueForUserAgentStringOfNetbsd()
{
$userAgentString = 'Links (2.2; NetBSD 5.1 amd64; 80x25)';
$infoArray = \TYPO3\CMS\Core\Utility\ClientUtility::getBrowserInfo($userAgentString);
$infoArray = ClientUtility::getBrowserInfo($userAgentString);
$this->assertContains('unix_bsd', $infoArray['all_systems']);
}

Expand All @@ -407,7 +407,7 @@ public function getBrowserInfoReturnsCorrectSystemValueForUserAgentStringOfNetbs
public function getBrowserInfoReturnsCorrectSystemValueForUserAgentStringOfFreebsd()
{
$userAgentString = 'Mozilla/5.0 (X11; U; FreeBSD amd64; c) AppleWebKit/531.2+ (KHTML, like Gecko) Safari 531.2+ Epiphany/230.2';
$infoArray = \TYPO3\CMS\Core\Utility\ClientUtility::getBrowserInfo($userAgentString);
$infoArray = ClientUtility::getBrowserInfo($userAgentString);
$this->assertContains('unix_bsd', $infoArray['all_systems']);
}

Expand All @@ -417,7 +417,7 @@ public function getBrowserInfoReturnsCorrectSystemValueForUserAgentStringOfFreeb
public function getBrowserInfoReturnsCorrectSystemValueForUserAgentStringOfChromeOs()
{
$userAgentString = 'Mozilla/5.0 (X11; U; CrOS i686 9.10.0; en-US) AppleWebKit/532.5 (KHTML, like Gecko) Chrome/4.0.253.0 Safari 532.5';
$infoArray = \TYPO3\CMS\Core\Utility\ClientUtility::getBrowserInfo($userAgentString);
$infoArray = ClientUtility::getBrowserInfo($userAgentString);
$this->assertContains('chrome', $infoArray['all_systems']);
}

Expand All @@ -427,7 +427,7 @@ public function getBrowserInfoReturnsCorrectSystemValueForUserAgentStringOfChrom
public function getBrowserInfoReturnsCorrectBrowserValueForUserAgentStringOfSafari()
{
$userAgentString = 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6; en-us) AppleWebKit/531.9 (KHTML, like Gecko) Version/4.0.3 Safari/531.9';
$infoArray = \TYPO3\CMS\Core\Utility\ClientUtility::getBrowserInfo($userAgentString);
$infoArray = ClientUtility::getBrowserInfo($userAgentString);
$this->assertSame('safari', $infoArray['browser']);
}

Expand All @@ -437,7 +437,7 @@ public function getBrowserInfoReturnsCorrectBrowserValueForUserAgentStringOfSafa
public function getBrowserInfoReturnsCorrectBrowserValueForUserAgentStringOfFirefox()
{
$userAgentString = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:2.0b8) Gecko/20100101 Firefox/4.0b8';
$infoArray = \TYPO3\CMS\Core\Utility\ClientUtility::getBrowserInfo($userAgentString);
$infoArray = ClientUtility::getBrowserInfo($userAgentString);
$this->assertSame('firefox', $infoArray['browser']);
}

Expand All @@ -447,7 +447,7 @@ public function getBrowserInfoReturnsCorrectBrowserValueForUserAgentStringOfFire
public function getBrowserInfoReturnsCorrectBrowserValueForUserAgentStringOfOpera()
{
$userAgentString = 'Opera/9.80 (X11; FreeBSD 8.1-RELEASE amd64; U; en) Presto/2.2.15 Version/10.10';
$infoArray = \TYPO3\CMS\Core\Utility\ClientUtility::getBrowserInfo($userAgentString);
$infoArray = ClientUtility::getBrowserInfo($userAgentString);
$this->assertSame('opera', $infoArray['browser']);
}

Expand All @@ -457,7 +457,7 @@ public function getBrowserInfoReturnsCorrectBrowserValueForUserAgentStringOfOper
public function getBrowserInfoReturnsCorrectBrowserValueForUserAgentStringOfMobileSafariOnAndroid()
{
$userAgentString = 'Mozilla/5.0 (Linux; U; Android WildPuzzleROM v8.0.7 froyo 2.2; de-de; HTC Wildfire Build/FRF91) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1';
$infoArray = \TYPO3\CMS\Core\Utility\ClientUtility::getBrowserInfo($userAgentString);
$infoArray = ClientUtility::getBrowserInfo($userAgentString);
$this->assertSame('safari', $infoArray['browser']);
}

Expand All @@ -467,7 +467,7 @@ public function getBrowserInfoReturnsCorrectBrowserValueForUserAgentStringOfMobi
public function getBrowserInfoReturnsCorrectBrowserValueForUserAgentStringOfMobileSafariOnIphone()
{
$userAgentString = 'Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_2_1 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8C148 Safari/6533.18.5';
$infoArray = \TYPO3\CMS\Core\Utility\ClientUtility::getBrowserInfo($userAgentString);
$infoArray = ClientUtility::getBrowserInfo($userAgentString);
$this->assertSame('safari', $infoArray['browser']);
}

Expand All @@ -477,7 +477,7 @@ public function getBrowserInfoReturnsCorrectBrowserValueForUserAgentStringOfMobi
public function getBrowserInfoReturnsCorrectBrowserValueForUserAgentStringOfKonqueror()
{
$userAgentString = 'Mozilla/5.0 (compatible; Konqueror/4.4; FreeBSD) KHTML/4.4.5 (like Gecko)';
$infoArray = \TYPO3\CMS\Core\Utility\ClientUtility::getBrowserInfo($userAgentString);
$infoArray = ClientUtility::getBrowserInfo($userAgentString);
$this->assertSame('konqueror', $infoArray['browser']);
}
}
4 changes: 3 additions & 1 deletion typo3/sysext/extbase/Classes/Reflection/ClassSchema.php
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,9 @@ public function addProperty($name, $type, $lazy = false, $cascade = '')
*/
public function getProperty($propertyName)
{
return is_array($this->properties[$propertyName]) ? $this->properties[$propertyName] : [];
return isset($this->properties[$propertyName]) && is_array($this->properties[$propertyName])
? $this->properties[$propertyName]
: [];
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,16 @@
*/

use TYPO3\CMS\Extbase\Reflection\ReflectionService;
use TYPO3\TestingFramework\Core\Unit\UnitTestCase;

/**
* Test case
* @see test for reflection
* @link second test for reflection
* @link second test for reflection with second value
*/
class ReflectionServiceTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
class ReflectionServiceTest extends UnitTestCase
{
/**
* Subject is not notice free, disable E_NOTICES
*/
protected static $suppressNotices = true;

/**
* @param array $foo The foo parameter
* @return string
Expand Down
Loading

0 comments on commit ff5145b

Please sign in to comment.