‪TYPO3CMS  ‪main
TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest Class Reference
Inheritance diagram for TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest:

Public Member Functions

bool isConnected ()
 
static cmpIPv4ReturnsTrueForMatchingAddress (string $ip, string $list)
 
static cmpIPv4ReturnsFalseForNotMatchingAddress (string $ip, string $list)
 
static cmpIPv6ReturnsTrueForMatchingAddress (string $ip, string $list)
 
static cmpIPv6ReturnsFalseForNotMatchingAddress (string $ip, string $list)
 
static normalizeIPv6CorrectlyNormalizesAddresses (string $compressed, string $normalized)
 
static validIpReturnsTrueForValidIp (string $ip)
 
static validIpReturnsFalseForInvalidIp (string $ip)
 
static cmpFqdnReturnsTrue (string $baseHost, string $list)
 
static cmpFqdnReturnsFalse (string $baseHost, string $list)
 
 inListForItemContainedReturnsTrue (string $haystack)
 
 inListForItemNotContainedReturnsFalse (string $haystack)
 
 expandListExpandsIntegerRanges (string $list, string $expectation)
 
 expandListExpandsForTwoThousandElementsExpandsOnlyToThousandElementsMaximum ()
 
 formatSizeTranslatesBytesToHigherOrderRepresentation ($size, $labels, $base, $expected)
 
 splitCalcCorrectlySplitsExpression (array $expected, string $expression)
 

Static Public Member Functions

static inListForItemContainedReturnsTrueDataProvider ()
 
static inListForItemNotContainedReturnsFalseDataProvider ()
 
static expandListExpandsIntegerRangesDataProvider ()
 
static formatSizeDataProvider ()
 
static array splitCalcDataProvider ()
 

Public Attributes

const NO_FIX_PERMISSIONS_ON_WINDOWS = 'fixPermissions() not available on Windows (method does nothing)'
 

Static Public Attributes

static array< string, function cmpIPv4DataProviderMatching():array { return['host with full IP address'=> ['127.0.0.1', '127.0.0.1']
 
static array< string, function cmpIPv4DataProviderNotMatching():array { return['single host'=> ['127.0.0.1', '127.0.0.2']
 
static array< string, function cmpIPv6DataProviderMatching():array { return['empty address'=> ['::', '::']
 
static array< string, function cmpIPv6DataProviderNotMatching():array { return['empty against localhost'=> ['::', '::1']
 
static array< string, function normalizeCompressIPv6DataProviderCorrect():array { return['empty'=> ['::', '0000:0000:0000:0000:0000:0000:0000:0000']
 
static array< string, function validIpDataProvider():array { return['0.0.0.0'=> ['0.0.0.0']
 
static array< string, function invalidIpDataProvider():array { return['zero string'=> ['0']
 
static array< string, function cmpFqdnValidDataProvider():array { return['localhost should usually resolve, IPv4'=> ['127.0.0.1', ' *']
 
static array< string, function cmpFqdnInvalidDataProvider():array { return['num-parts of hostname to check can only be less or equal than hostname, 1'=> ['aaa.bbb.ccc.ddd.eee', 'aaa.bbb.ccc.ddd.eee.fff']
 
static array< string, function validEmailValidDataProvider():array { return['short mail address'=> ['a @b.c']
 

Protected Member Functions

 setUp ()
 
 tearDown ()
 
 getTestDirectory (string $prefix='root_')
 

Protected Attributes

bool $resetSingletonInstances = true
 
bool $backupEnvironment = true
 
PackageManager $backupPackageManager
 

Detailed Description

Definition at line 47 of file GeneralUtilityTest.php.

Member Function Documentation

◆ cmpFqdnReturnsFalse()

static TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest::cmpFqdnReturnsFalse ( string  $baseHost,
string  $list 
)

◆ cmpFqdnReturnsTrue()

static TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest::cmpFqdnReturnsTrue ( string  $baseHost,
string  $list 
)

◆ cmpIPv4ReturnsFalseForNotMatchingAddress()

static TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest::cmpIPv4ReturnsFalseForNotMatchingAddress ( string  $ip,
string  $list 
)

◆ cmpIPv4ReturnsTrueForMatchingAddress()

static TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest::cmpIPv4ReturnsTrueForMatchingAddress ( string  $ip,
string  $list 
)

◆ cmpIPv6ReturnsFalseForNotMatchingAddress()

static TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest::cmpIPv6ReturnsFalseForNotMatchingAddress ( string  $ip,
string  $list 
)

◆ cmpIPv6ReturnsTrueForMatchingAddress()

static TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest::cmpIPv6ReturnsTrueForMatchingAddress ( string  $ip,
string  $list 
)

◆ expandListExpandsForTwoThousandElementsExpandsOnlyToThousandElementsMaximum()

TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest::expandListExpandsForTwoThousandElementsExpandsOnlyToThousandElementsMaximum ( )

◆ expandListExpandsIntegerRanges()

TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest::expandListExpandsIntegerRanges ( string  $list,
string  $expectation 
)

◆ expandListExpandsIntegerRangesDataProvider()

static TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest::expandListExpandsIntegerRangesDataProvider ( )
static

Data provider for expandListExpandsIntegerRangesDataProvider

Definition at line 389 of file GeneralUtilityTest.php.

◆ formatSizeDataProvider()

static TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest::formatSizeDataProvider ( )
static

Data provider for formatSizeTranslatesBytesToHigherOrderRepresentation

Definition at line 424 of file GeneralUtilityTest.php.

◆ formatSizeTranslatesBytesToHigherOrderRepresentation()

TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest::formatSizeTranslatesBytesToHigherOrderRepresentation (   $size,
  $labels,
  $base,
  $expected 
)

Definition at line 416 of file GeneralUtilityTest.php.

◆ getTestDirectory()

TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest::getTestDirectory ( string  $prefix = 'root_')
protected

Helper method to create a random directory and return the path. The path will be registered for deletion upon test ending

Definition at line 93 of file GeneralUtilityTest.php.

References TYPO3\CMS\Core\Utility\StringUtility\getUniqueId(), TYPO3\CMS\Core\Core\Environment\getVarPath(), and TYPO3\CMS\Core\Utility\GeneralUtility\mkdir_deep().

◆ inListForItemContainedReturnsTrue()

TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest::inListForItemContainedReturnsTrue ( string  $haystack)

◆ inListForItemContainedReturnsTrueDataProvider()

static TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest::inListForItemContainedReturnsTrueDataProvider ( )
static

Data provider for inListForItemContainedReturnsTrue.

Definition at line 347 of file GeneralUtilityTest.php.

◆ inListForItemNotContainedReturnsFalse()

TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest::inListForItemNotContainedReturnsFalse ( string  $haystack)

◆ inListForItemNotContainedReturnsFalseDataProvider()

static TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest::inListForItemNotContainedReturnsFalseDataProvider ( )
static

Data provider for inListForItemNotContainedReturnsFalse.

Definition at line 367 of file GeneralUtilityTest.php.

◆ isConnected()

bool TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest::isConnected ( )

Helper method to test for an existing internet connection. Some tests are skipped if there is no working uplink.

Returns
‪bool $isConnected

Definition at line 78 of file GeneralUtilityTest.php.

◆ normalizeIPv6CorrectlyNormalizesAddresses()

static TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest::normalizeIPv6CorrectlyNormalizesAddresses ( string  $compressed,
string  $normalized 
)

◆ setUp()

TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest::setUp ( )
protected

◆ splitCalcCorrectlySplitsExpression()

TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest::splitCalcCorrectlySplitsExpression ( array  $expected,
string  $expression 
)

Definition at line 491 of file GeneralUtilityTest.php.

◆ splitCalcDataProvider()

static array TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest::splitCalcDataProvider ( )
static

Data provider for splitCalc

Returns
‪array expected values, arithmetic expression

Definition at line 471 of file GeneralUtilityTest.php.

◆ tearDown()

TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest::tearDown ( )
protected

◆ validIpReturnsFalseForInvalidIp()

static TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest::validIpReturnsFalseForInvalidIp ( string  $ip)

◆ validIpReturnsTrueForValidIp()

static TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest::validIpReturnsTrueForValidIp ( string  $ip)

Member Data Documentation

◆ $backupEnvironment

bool TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest::$backupEnvironment = true
protected

Definition at line 53 of file GeneralUtilityTest.php.

◆ $backupPackageManager

PackageManager TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest::$backupPackageManager
protected

Definition at line 55 of file GeneralUtilityTest.php.

◆ $resetSingletonInstances

bool TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest::$resetSingletonInstances = true
protected

Definition at line 51 of file GeneralUtilityTest.php.

◆ array< string, function cmpFqdnInvalidDataProvider():array { return['num-parts of hostname to check can only be less or equal than hostname, 1'=>

TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest::array< string, function cmpFqdnInvalidDataProvider():array { return[ 'num-parts of hostname to check can only be less or equal than hostname, 1'=>[ 'aaa.bbb.ccc.ddd.eee', 'aaa.bbb.ccc.ddd.eee.fff']
static

Data provider for cmpFqdnReturnsFalse

Returns
‪array<string, array{0: string, 1: string}>

Definition at line 319 of file GeneralUtilityTest.php.

◆ array< string, function cmpFqdnValidDataProvider():array { return['localhost should usually resolve, IPv4'=>

TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest::array< string, function cmpFqdnValidDataProvider():array { return[ 'localhost should usually resolve, IPv4'=>[ '127.0.0.1', ' *']
static

Data provider for cmpFqdnReturnsTrue

Returns
‪array<string, array{0: string, 1: string}>

Definition at line 291 of file GeneralUtilityTest.php.

◆ array< string, function cmpIPv4DataProviderMatching():array { return['host with full IP address'=>

TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest::array< string, function cmpIPv4DataProviderMatching():array { return[ 'host with full IP address'=>[ '127.0.0.1', '127.0.0.1']
static
Returns
‪array<string, array{0: string, 1: string}>

Definition at line 104 of file GeneralUtilityTest.php.

◆ array< string, function cmpIPv4DataProviderNotMatching():array { return['single host'=>

TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest::array< string, function cmpIPv4DataProviderNotMatching():array { return[ 'single host'=>[ '127.0.0.1', '127.0.0.2']
static

Data provider for cmpIPv4ReturnsFalseForNotMatchingAddress

Returns
‪array<string, array{0: string, 1: string}>

Definition at line 131 of file GeneralUtilityTest.php.

◆ array< string, function cmpIPv6DataProviderMatching():array { return['empty address'=>

TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest::array< string, function cmpIPv6DataProviderMatching():array { return[ 'empty address'=>['::', '::']
static

Data provider for cmpIPv6ReturnsTrueForMatchingAddress

Returns
‪array<string, array{0: string, 1: string}>

Definition at line 158 of file GeneralUtilityTest.php.

◆ array< string, function cmpIPv6DataProviderNotMatching():array { return['empty against localhost'=>

TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest::array< string, function cmpIPv6DataProviderNotMatching():array { return[ 'empty against localhost'=>['::', '::1']
static

Data provider for cmpIPv6ReturnsFalseForNotMatchingAddress

Returns
‪array<string, array{0: string, 1: string}>

Definition at line 186 of file GeneralUtilityTest.php.

◆ array< string, function invalidIpDataProvider():array { return['zero string'=>

TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest::array< string, function invalidIpDataProvider():array { return[ 'zero string'=>[ '0']
static

Data provider for checkValidIpReturnsFalseForInvalidIp

Returns
‪array<string, array{0: string}>

Definition at line 264 of file GeneralUtilityTest.php.

◆ array< string, function normalizeCompressIPv6DataProviderCorrect():array { return['empty'=>

TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest::array< string, function normalizeCompressIPv6DataProviderCorrect():array { return[ 'empty'=>['::', '0000:0000:0000:0000:0000:0000:0000:0000']
static

Data provider for normalizeIPv6ReturnsCorrectlyNormalizedFormat

Returns
‪array<string, array{0: string, 1: string}>

Definition at line 215 of file GeneralUtilityTest.php.

◆ array< string, function validEmailValidDataProvider():array { return['short mail address'=>

TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest::array< string, function validEmailValidDataProvider():array { return[ 'short mail address'=>[ 'a @b.c']
static

Data provider for valid validEmail's

Returns
‪array<string, array{0: string}>

Definition at line 504 of file GeneralUtilityTest.php.

◆ array< string, function validIpDataProvider():array { return['0.0.0.0'=>

TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest::array< string, function validIpDataProvider():array { return[ '0.0.0.0'=>[ '0.0.0.0']
static

Data provider for checkValidIpReturnsTrueForValidIp

Returns
‪array<string, array{0: string}>

Definition at line 242 of file GeneralUtilityTest.php.

◆ NO_FIX_PERMISSIONS_ON_WINDOWS

const TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest::NO_FIX_PERMISSIONS_ON_WINDOWS = 'fixPermissions() not available on Windows (method does nothing)'

Definition at line 49 of file GeneralUtilityTest.php.