ArrayTest.php 769 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. namespace PhpOffice\PhpSpreadsheetTests\Calculation;
  3. use PhpOffice\PhpSpreadsheet\Calculation\Functions;
  4. use PHPUnit\Framework\TestCase;
  5. class ArrayTest extends TestCase
  6. {
  7. public function testMultiDimensionalArrayIsFlattened(): void
  8. {
  9. $array = [
  10. 0 => [
  11. 0 => [
  12. 32 => [
  13. 'B' => 'PHP',
  14. ],
  15. ],
  16. ],
  17. 1 => [
  18. 0 => [
  19. 32 => [
  20. 'C' => 'Spreadsheet',
  21. ],
  22. ],
  23. ],
  24. ];
  25. $values = Functions::flattenArray($array);
  26. self::assertIsNotArray($values[0]);
  27. self::assertIsNotArray($values[1]);
  28. }
  29. }