2017-12-17 07:34:40 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace PhpOffice\PhpSpreadsheetTests\Functional;
|
|
|
|
|
|
|
|
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
|
|
|
|
2018-01-01 15:53:28 +00:00
|
|
|
class EnclosureTest extends AbstractFunctional
|
2017-12-17 07:34:40 +00:00
|
|
|
{
|
|
|
|
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
|
2017-12-17 07:34:40 +00:00
|
|
|
{
|
|
|
|
$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');
|
|
|
|
}
|
|
|
|
}
|