TYPO3 CMS  TYPO3_6-2
TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest Class Reference
Inheritance diagram for TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest:
TYPO3\CMS\Core\Tests\UnitTestCase TYPO3\CMS\Core\Tests\BaseTestCase

Public Member Functions

 filterByValueRecursive ()
 
 filterByValueRecursiveCorrectlyFiltersArray ($needle, $haystack, $expectedResult)
 
 filterByValueRecursiveMatchesReferencesToSameObject ()
 
 filterByValueRecursiveDoesNotMatchDifferentInstancesOfSameClass ()
 
 isValidPathReturnsTrueIfPathExists ()
 
 isValidPathReturnsFalseIfPathDoesNotExist ()
 
 getValueByPathThrowsExceptionIfPathIsEmpty ()
 
 getValueByPathInvalidPathDataProvider ()
 
 getValueByPathThrowsExceptionIfPathNotExists (array $array, $path)
 
 getValueByPathValidDataProvider ()
 
 getValueByPathGetsCorrectValue (array $array, $path, $expectedResult)
 
 getValueByPathAccpetsDifferentDelimeter ()
 
 setValueByPathThrowsExceptionIfPathIsEmpty ()
 
 setValueByPathThrowsExceptionIfPathIsNotAString ()
 
 setValueByPathSetsCorrectValueDataProvider ()
 
 setValueByPathSetsCorrectValue (array $array, $path, $value, $expectedResult)
 
 removeByPathThrowsExceptionIfPathIsEmpty ()
 
 removeByPathThrowsExceptionIfPathIsNotAString ()
 
 removeByPathThrowsExceptionWithEmptyPathSegment ()
 
 removeByPathThrowsExceptionIfPathDoesNotExistInArray ()
 
 removeByPathAcceptsGivenDelimiter ()
 
 removeByPathRemovesCorrectPathDataProvider ()
 
 removeByPathRemovesCorrectPath (array $array, $path, $expectedResult)
 
 sortByKeyRecursiveCheckIfSortingIsCorrect ()
 
 sortArraysByKeyCheckIfSortingIsCorrectDataProvider ()
 
 sortArraysByKeyCheckIfSortingIsCorrect (array $array, $key, $ascending, $expectedResult)
 
 sortArraysByKeyThrowsExceptionForNonExistingKey ()
 
 arrayExportReturnsFormattedMultidimensionalArray ()
 
 arrayExportThrowsExceptionIfObjectShouldBeExported ()
 
 arrayExportReturnsNumericArrayKeys ()
 
 arrayExportReturnsNoKeyIndexForConsecutiveCountedArrays ()
 
 arrayExportReturnsKeyIndexForNonConsecutiveCountedArrays ()
 
 flattenCalculatesExpectedResultDataProvider ()
 
 flattenCalculatesExpectedResult (array $array, array $expected)
 
 intersectRecursiveCalculatesExpectedResultDataProvider ()
 
 intersectRecursiveCalculatesExpectedResult (array $source, array $mask, array $expected)
 
 renumberKeysToAvoidLeapsIfKeysAreAllNumericDataProvider ()
 
 renumberKeysToAvoidLeapsIfKeysAreAllNumeric (array $inputArray, array $expected)
 
 arrayMergeRecursiveOverruleDoesConsiderUnsetValues ()
 

Additional Inherited Members

- Protected Member Functions inherited from TYPO3\CMS\Core\Tests\UnitTestCase
 tearDown ()
 
- Protected Member Functions inherited from TYPO3\CMS\Core\Tests\BaseTestCase
 getAccessibleMock ( $originalClassName, array $methods=array(), array $arguments=array(), $mockClassName='', $callOriginalConstructor=TRUE, $callOriginalClone=TRUE, $callAutoload=TRUE)
 
 getAccessibleMockForAbstractClass ( $originalClassName, array $arguments=array(), $mockClassName='', $callOriginalConstructor=TRUE, $callOriginalClone=TRUE, $callAutoload=TRUE)
 
 buildAccessibleProxy ($className)
 
 callInaccessibleMethod ($object, $name)
 
 inject ($target, $name, $dependency)
 
 getUniqueId ($prefix='')
 
- Protected Attributes inherited from TYPO3\CMS\Core\Tests\UnitTestCase
 $backupGlobalsBlacklist = array('TYPO3_LOADED_EXT')
 
- Protected Attributes inherited from TYPO3\CMS\Core\Tests\BaseTestCase
 $backupGlobals = TRUE
 
 $backupStaticAttributes = FALSE
 

Detailed Description

Member Function Documentation

◆ arrayExportReturnsFormattedMultidimensionalArray()

TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest::arrayExportReturnsFormattedMultidimensionalArray ( )

◆ arrayExportReturnsKeyIndexForNonConsecutiveCountedArrays()

TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest::arrayExportReturnsKeyIndexForNonConsecutiveCountedArrays ( )

◆ arrayExportReturnsNoKeyIndexForConsecutiveCountedArrays()

TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest::arrayExportReturnsNoKeyIndexForConsecutiveCountedArrays ( )

◆ arrayExportReturnsNumericArrayKeys()

TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest::arrayExportReturnsNumericArrayKeys ( )

◆ arrayExportThrowsExceptionIfObjectShouldBeExported()

TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest::arrayExportThrowsExceptionIfObjectShouldBeExported ( )

◆ arrayMergeRecursiveOverruleDoesConsiderUnsetValues()

TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest::arrayMergeRecursiveOverruleDoesConsiderUnsetValues ( )

◆ filterByValueRecursive()

TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest::filterByValueRecursive ( )

Data provider for filterByValueRecursiveCorrectlyFiltersArray

Every array splits into:

  • String value to search for
  • Input array
  • Expected result array

Definition at line 38 of file ArrayUtilityTest.php.

◆ filterByValueRecursiveCorrectlyFiltersArray()

TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest::filterByValueRecursiveCorrectlyFiltersArray (   $needle,
  $haystack,
  $expectedResult 
)
Test:
filterByValueRecursive

Definition at line 163 of file ArrayUtilityTest.php.

References TYPO3\CMS\Core\Utility\ArrayUtility\filterByValueRecursive().

◆ filterByValueRecursiveDoesNotMatchDifferentInstancesOfSameClass()

TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest::filterByValueRecursiveDoesNotMatchDifferentInstancesOfSameClass ( )

◆ filterByValueRecursiveMatchesReferencesToSameObject()

TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest::filterByValueRecursiveMatchesReferencesToSameObject ( )

◆ flattenCalculatesExpectedResult()

TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest::flattenCalculatesExpectedResult ( array  $array,
array  $expected 
)
Test:
Parameters
array$array
array$expectedflattenCalculatesExpectedResultDataProvider

Definition at line 1137 of file ArrayUtilityTest.php.

References TYPO3\CMS\Core\Utility\ArrayUtility\flatten().

◆ flattenCalculatesExpectedResultDataProvider()

TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest::flattenCalculatesExpectedResultDataProvider ( )
Returns
array

Definition at line 1042 of file ArrayUtilityTest.php.

◆ getValueByPathAccpetsDifferentDelimeter()

TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest::getValueByPathAccpetsDifferentDelimeter ( )

◆ getValueByPathGetsCorrectValue()

TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest::getValueByPathGetsCorrectValue ( array  $array,
  $path,
  $expectedResult 
)
Test:
getValueByPathValidDataProvider

Definition at line 400 of file ArrayUtilityTest.php.

References TYPO3\CMS\Core\Utility\ArrayUtility\getValueByPath().

◆ getValueByPathInvalidPathDataProvider()

TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest::getValueByPathInvalidPathDataProvider ( )

Data provider for getValueByPathThrowsExceptionIfPathNotExists Every array splits into:

  • Array to get value from
  • String path
  • Expected result

Definition at line 251 of file ArrayUtilityTest.php.

◆ getValueByPathThrowsExceptionIfPathIsEmpty()

TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest::getValueByPathThrowsExceptionIfPathIsEmpty ( )

◆ getValueByPathThrowsExceptionIfPathNotExists()

TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest::getValueByPathThrowsExceptionIfPathNotExists ( array  $array,
  $path 
)
Test:
getValueByPathInvalidPathDataProvider

Definition at line 300 of file ArrayUtilityTest.php.

References TYPO3\CMS\Core\Utility\ArrayUtility\getValueByPath().

◆ getValueByPathValidDataProvider()

TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest::getValueByPathValidDataProvider ( )

Data provider for getValueByPathReturnsCorrectValue Every array splits into:

  • Array to get value from
  • String path
  • Expected result

Definition at line 311 of file ArrayUtilityTest.php.

◆ intersectRecursiveCalculatesExpectedResult()

TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest::intersectRecursiveCalculatesExpectedResult ( array  $source,
array  $mask,
array  $expected 
)
Test:
Parameters
array$source
array$mask
array$expectedintersectRecursiveCalculatesExpectedResultDataProvider

Definition at line 1349 of file ArrayUtilityTest.php.

References TYPO3\CMS\Core\Utility\ArrayUtility\intersectRecursive().

◆ intersectRecursiveCalculatesExpectedResultDataProvider()

TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest::intersectRecursiveCalculatesExpectedResultDataProvider ( )
Returns
array

Definition at line 1149 of file ArrayUtilityTest.php.

◆ isValidPathReturnsFalseIfPathDoesNotExist()

TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest::isValidPathReturnsFalseIfPathDoesNotExist ( )

◆ isValidPathReturnsTrueIfPathExists()

TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest::isValidPathReturnsTrueIfPathExists ( )

Mock the class under test, isValidPath() (method under test), calls static getValuePath() internally, which is mocked here to return a specific result. This works because of 'static' keyword' instead of 'self' for getValueByPath() call, using late static binding in PHP 5.3

Test:

Definition at line 202 of file ArrayUtilityTest.php.

References TYPO3\CMS\Core\Tests\BaseTestCase\getUniqueId().

◆ removeByPathAcceptsGivenDelimiter()

TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest::removeByPathAcceptsGivenDelimiter ( )

◆ removeByPathRemovesCorrectPath()

TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest::removeByPathRemovesCorrectPath ( array  $array,
  $path,
  $expectedResult 
)
Test:
removeByPathRemovesCorrectPathDataProvider

Definition at line 745 of file ArrayUtilityTest.php.

References TYPO3\CMS\Core\Utility\ArrayUtility\removeByPath().

◆ removeByPathRemovesCorrectPathDataProvider()

TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest::removeByPathRemovesCorrectPathDataProvider ( )

Data provider for removeByPathRemovesCorrectPath

Definition at line 697 of file ArrayUtilityTest.php.

◆ removeByPathThrowsExceptionIfPathDoesNotExistInArray()

TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest::removeByPathThrowsExceptionIfPathDoesNotExistInArray ( )

◆ removeByPathThrowsExceptionIfPathIsEmpty()

TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest::removeByPathThrowsExceptionIfPathIsEmpty ( )

◆ removeByPathThrowsExceptionIfPathIsNotAString()

TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest::removeByPathThrowsExceptionIfPathIsNotAString ( )

◆ removeByPathThrowsExceptionWithEmptyPathSegment()

TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest::removeByPathThrowsExceptionWithEmptyPathSegment ( )

◆ renumberKeysToAvoidLeapsIfKeysAreAllNumeric()

TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest::renumberKeysToAvoidLeapsIfKeysAreAllNumeric ( array  $inputArray,
array  $expected 
)
Test:
Parameters
array$inputArray
array$expectedrenumberKeysToAvoidLeapsIfKeysAreAllNumericDataProvider

Definition at line 1481 of file ArrayUtilityTest.php.

References TYPO3\CMS\Core\Utility\ArrayUtility\renumberKeysToAvoidLeapsIfKeysAreAllNumeric().

◆ renumberKeysToAvoidLeapsIfKeysAreAllNumericDataProvider()

TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest::renumberKeysToAvoidLeapsIfKeysAreAllNumericDataProvider ( )
Returns
array

Definition at line 1360 of file ArrayUtilityTest.php.

◆ setValueByPathSetsCorrectValue()

TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest::setValueByPathSetsCorrectValue ( array  $array,
  $path,
  $value,
  $expectedResult 
)
Test:
setValueByPathSetsCorrectValueDataProvider

Definition at line 619 of file ArrayUtilityTest.php.

References TYPO3\CMS\Core\Utility\ArrayUtility\setValueByPath().

◆ setValueByPathSetsCorrectValueDataProvider()

TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest::setValueByPathSetsCorrectValueDataProvider ( )

Data provider for setValueByPathSetsCorrectValueDataProvider

Every array splits into:

  • Array to set value in
  • String path
  • Value to set
  • Expected result

Definition at line 453 of file ArrayUtilityTest.php.

◆ setValueByPathThrowsExceptionIfPathIsEmpty()

TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest::setValueByPathThrowsExceptionIfPathIsEmpty ( )

◆ setValueByPathThrowsExceptionIfPathIsNotAString()

TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest::setValueByPathThrowsExceptionIfPathIsNotAString ( )

◆ sortArraysByKeyCheckIfSortingIsCorrect()

TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest::sortArraysByKeyCheckIfSortingIsCorrect ( array  $array,
  $key,
  $ascending,
  $expectedResult 
)
Test:
sortArraysByKeyCheckIfSortingIsCorrectDataProvider

Definition at line 911 of file ArrayUtilityTest.php.

References TYPO3\CMS\Core\Utility\ArrayUtility\sortArraysByKey().

◆ sortArraysByKeyCheckIfSortingIsCorrectDataProvider()

TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest::sortArraysByKeyCheckIfSortingIsCorrectDataProvider ( )

Data provider for sortArraysByKeyCheckIfSortingIsCorrect

Definition at line 788 of file ArrayUtilityTest.php.

◆ sortArraysByKeyThrowsExceptionForNonExistingKey()

TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest::sortArraysByKeyThrowsExceptionForNonExistingKey ( )

◆ sortByKeyRecursiveCheckIfSortingIsCorrect()

TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest::sortByKeyRecursiveCheckIfSortingIsCorrect ( )