PhpSpreadsheet/tests/PhpSpreadsheetTests/Calculation/DefinedNameConfusedForCellTest.php
oleibman 585409a949
Testing - Delete Temp Files When No Longer Needed (#1488)
No code changes. The tests in all of these scripts write to at least
one temporary file, which is then read and not used again. The file
should be deleted to avoid filling up the disk system.
2020-05-24 20:03:07 +09:00

24 lines
789 B
PHP

<?php
namespace PhpOffice\PhpSpreadsheetTests\Calculation;
use PhpOffice\PhpSpreadsheet\Shared\File;
use PHPUnit\Framework\TestCase;
class DefinedNameConfusedForCellTest extends TestCase
{
public function testDefinedName(): void
{
$obj = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
$sheet0 = $obj->setActiveSheetIndex(0);
$sheet0->setCellValue('A1', 2);
$obj->addNamedRange(new \PhpOffice\PhpSpreadsheet\NamedRange('A1A', $sheet0, 'A1'));
$sheet0->setCellValue('B1', '=2*A1A');
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($obj, 'Xlsx');
$filename = tempnam(File::sysGetTempDir(), 'phpspreadsheet-test');
$writer->save($filename);
self::assertTrue(true);
unlink($filename);
}
}