PhpSpreadsheet/tests/PhpSpreadsheetTests/Functional/EnclosureTest.php

38 lines
959 B
PHP
Raw Normal View History

<?php
namespace PhpOffice\PhpSpreadsheetTests\Functional;
use PhpOffice\PhpSpreadsheet\Spreadsheet;
2018-01-01 15:53:28 +00:00
class EnclosureTest extends AbstractFunctional
{
public function providerFormats()
{
return [
['Html'],
['Xls'],
['Xlsx'],
['Ods'],
['Csv'],
];
}
/**
* @dataProvider providerFormats
*
* @param string $format
*/
2020-05-18 04:49:57 +00:00
public function testEnclosure($format): void
{
$value = '<img alt="" src="http://example.com/image.jpg" />';
$spreadsheet = new Spreadsheet();
$spreadsheet->getActiveSheet()->getCell('A1')->setValue($value);
$reloadedSpreadsheet = $this->writeAndReload($spreadsheet, $format);
$actual = $reloadedSpreadsheet->getActiveSheet()->getCell('A1')->getCalculatedValue();
self::assertSame($value, $actual, 'should be able to write and read strings with multiples quotes');
}
}