ArrayToTextTest.php 727 B

123456789101112131415161718192021222324
  1. <?php
  2. namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\TextData;
  3. class ArrayToTextTest extends AllSetupTeardown
  4. {
  5. /**
  6. * @dataProvider providerARRAYTOTEXT
  7. */
  8. public function testArrayToText(string $expectedResult, array $testData, int $mode): void
  9. {
  10. $worksheet = $this->getSheet();
  11. $worksheet->fromArray($testData, null, 'A1', true);
  12. $worksheet->getCell('H1')->setValue("=ARRAYTOTEXT(A1:C5, {$mode})");
  13. $result = $worksheet->getCell('H1')->getCalculatedValue();
  14. self::assertSame($expectedResult, $result);
  15. }
  16. public function providerARRAYTOTEXT(): array
  17. {
  18. return require 'tests/data/Calculation/TextData/ARRAYTOTEXT.php';
  19. }
  20. }