mirror of
https://github.com/PHPOffice/PhpSpreadsheet.git
synced 2026-08-25 20:38:21 +00:00
ec4098c8fd
While we might never be able to have 100% of our code strict, we can at the very least do it for all of our tests. This ensures that our tests are using our API with the types as intended by the test author, and not silently be cast to what our API requires.
31 lines
980 B
PHP
31 lines
980 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace PhpOffice\PhpSpreadsheetTests\Calculation;
|
|
|
|
use PhpOffice\PhpSpreadsheet\NamedRange;
|
|
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
class DefinedNameWithQuotePrefixedCellTest extends TestCase
|
|
{
|
|
public function testDefinedNameIsAlwaysEvaluated(): void
|
|
{
|
|
$spreadsheet = new Spreadsheet();
|
|
$sheet1 = $spreadsheet->getActiveSheet();
|
|
$sheet1->setTitle('Sheet1');
|
|
$sheet2 = $spreadsheet->createSheet();
|
|
$sheet2->setTitle('Sheet2');
|
|
$sheet2->getCell('A1')->setValue('July 2019');
|
|
$sheet2->getStyle('A1')
|
|
->setQuotePrefix(true);
|
|
$sheet2->getCell('A2')->setValue(3);
|
|
$spreadsheet->addNamedRange(new NamedRange('FM', $sheet2, '$A$2'));
|
|
$sheet1->getCell('A1')->setValue('=(A2+FM)');
|
|
$sheet1->getCell('A2')->setValue(38.42);
|
|
|
|
self::assertSame(41.42, $sheet1->getCell('A1')->getCalculatedValue());
|
|
}
|
|
}
|