Minor Improvement to Test Cleanup MathTrig

Permit spreadsheet allocated as private member in test class to be garbage-collected after test completion.
This commit is contained in:
Owen Leibman 2021-05-13 18:22:59 -07:00 committed by Mark Baker
parent 9204d2d6b3
commit 4df184320a
74 changed files with 114 additions and 92 deletions

View File

@ -12,7 +12,7 @@ class AbsTest extends AllSetupTeardown
*/ */
public function testRound($expectedResult, $number = 'omitted'): void public function testRound($expectedResult, $number = 'omitted'): void
{ {
$sheet = $this->sheet; $sheet = $this->getSheet();
$this->mightHaveException($expectedResult); $this->mightHaveException($expectedResult);
$this->setCell('A1', $number); $this->setCell('A1', $number);
if ($number === 'omitted') { if ($number === 'omitted') {

View File

@ -12,7 +12,7 @@ class AcosTest extends AllSetupTeardown
public function testAcos($expectedResult, string $formula): void public function testAcos($expectedResult, string $formula): void
{ {
$this->mightHaveException($expectedResult); $this->mightHaveException($expectedResult);
$sheet = $this->sheet; $sheet = $this->getSheet();
$sheet->getCell('A2')->setValue(0.5); $sheet->getCell('A2')->setValue(0.5);
$sheet->getCell('A1')->setValue("=ACOS($formula)"); $sheet->getCell('A1')->setValue("=ACOS($formula)");
$result = $sheet->getCell('A1')->getCalculatedValue(); $result = $sheet->getCell('A1')->getCalculatedValue();

View File

@ -12,7 +12,7 @@ class AcoshTest extends AllSetupTeardown
public function testAcosh($expectedResult, string $formula): void public function testAcosh($expectedResult, string $formula): void
{ {
$this->mightHaveException($expectedResult); $this->mightHaveException($expectedResult);
$sheet = $this->sheet; $sheet = $this->getSheet();
$sheet->getCell('A2')->setValue('1.5'); $sheet->getCell('A2')->setValue('1.5');
$sheet->getCell('A1')->setValue("=ACOSH($formula)"); $sheet->getCell('A1')->setValue("=ACOSH($formula)");
$result = $sheet->getCell('A1')->getCalculatedValue(); $result = $sheet->getCell('A1')->getCalculatedValue();

View File

@ -13,7 +13,7 @@ class AcotTest extends AllSetupTeardown
public function testACOT($expectedResult, $number): void public function testACOT($expectedResult, $number): void
{ {
$this->mightHaveException($expectedResult); $this->mightHaveException($expectedResult);
$sheet = $this->sheet; $sheet = $this->getSheet();
$sheet->setCellValue('A2', 1.3); $sheet->setCellValue('A2', 1.3);
$sheet->setCellValue('A3', 2.7); $sheet->setCellValue('A3', 2.7);
$sheet->setCellValue('A4', -3.8); $sheet->setCellValue('A4', -3.8);

View File

@ -13,7 +13,7 @@ class AcothTest extends AllSetupTeardown
public function testACOTH($expectedResult, $number): void public function testACOTH($expectedResult, $number): void
{ {
$this->mightHaveException($expectedResult); $this->mightHaveException($expectedResult);
$sheet = $this->sheet; $sheet = $this->getSheet();
$sheet->setCellValue('A2', 1.3); $sheet->setCellValue('A2', 1.3);
$sheet->setCellValue('A3', 2.7); $sheet->setCellValue('A3', 2.7);
$sheet->setCellValue('A4', -3.8); $sheet->setCellValue('A4', -3.8);

View File

@ -17,26 +17,28 @@ class AllSetupTeardown extends TestCase
private $compatibilityMode; private $compatibilityMode;
/** /**
* @var Spreadsheet * @var ?Spreadsheet
*/ */
private $spreadsheet; private $spreadsheet;
/** /**
* @var Worksheet * @var ?Worksheet
*/ */
protected $sheet; private $sheet;
protected function setUp(): void protected function setUp(): void
{ {
$this->compatibilityMode = Functions::getCompatibilityMode(); $this->compatibilityMode = Functions::getCompatibilityMode();
$this->spreadsheet = new Spreadsheet();
$this->sheet = $this->spreadsheet->getActiveSheet();
} }
protected function tearDown(): void protected function tearDown(): void
{ {
Functions::setCompatibilityMode($this->compatibilityMode); Functions::setCompatibilityMode($this->compatibilityMode);
$this->sheet = null;
if ($this->spreadsheet !== null) {
$this->spreadsheet->disconnectWorksheets(); $this->spreadsheet->disconnectWorksheets();
$this->spreadsheet = null;
}
} }
protected static function setOpenOffice(): void protected static function setOpenOffice(): void
@ -66,10 +68,30 @@ class AllSetupTeardown extends TestCase
{ {
if ($value !== null) { if ($value !== null) {
if (is_string($value) && is_numeric($value)) { if (is_string($value) && is_numeric($value)) {
$this->sheet->getCell($cell)->setValueExplicit($value, DataType::TYPE_STRING); $this->getSheet()->getCell($cell)->setValueExplicit($value, DataType::TYPE_STRING);
} else { } else {
$this->sheet->getCell($cell)->setValue($value); $this->getSheet()->getCell($cell)->setValue($value);
} }
} }
} }
protected function getSpreadsheet(): Spreadsheet
{
if ($this->spreadsheet !== null) {
return $this->spreadsheet;
}
$this->spreadsheet = new Spreadsheet();
return $this->spreadsheet;
}
protected function getSheet(): Worksheet
{
if ($this->sheet !== null) {
return $this->sheet;
}
$this->sheet = $this->getSpreadsheet()->getActiveSheet();
return $this->sheet;
}
} }

View File

@ -13,7 +13,7 @@ class ArabicTest extends AllSetupTeardown
public function testARABIC($expectedResult, $romanNumeral): void public function testARABIC($expectedResult, $romanNumeral): void
{ {
$this->mightHaveException($expectedResult); $this->mightHaveException($expectedResult);
$sheet = $this->sheet; $sheet = $this->getSheet();
$sheet->getCell('A1')->setValue($romanNumeral); $sheet->getCell('A1')->setValue($romanNumeral);
$sheet->getCell('B1')->setValue('=ARABIC(A1)'); $sheet->getCell('B1')->setValue('=ARABIC(A1)');
$result = $sheet->getCell('B1')->getCalculatedValue(); $result = $sheet->getCell('B1')->getCalculatedValue();

View File

@ -12,7 +12,7 @@ class AsinTest extends AllSetupTeardown
public function testAsin($expectedResult, string $formula): void public function testAsin($expectedResult, string $formula): void
{ {
$this->mightHaveException($expectedResult); $this->mightHaveException($expectedResult);
$sheet = $this->sheet; $sheet = $this->getSheet();
$sheet->getCell('A2')->setValue(0.5); $sheet->getCell('A2')->setValue(0.5);
$sheet->getCell('A1')->setValue("=ASIN($formula)"); $sheet->getCell('A1')->setValue("=ASIN($formula)");
$result = $sheet->getCell('A1')->getCalculatedValue(); $result = $sheet->getCell('A1')->getCalculatedValue();

View File

@ -12,7 +12,7 @@ class AsinhTest extends AllSetupTeardown
public function testAsinh($expectedResult, string $formula): void public function testAsinh($expectedResult, string $formula): void
{ {
$this->mightHaveException($expectedResult); $this->mightHaveException($expectedResult);
$sheet = $this->sheet; $sheet = $this->getSheet();
$sheet->getCell('A2')->setValue(0.5); $sheet->getCell('A2')->setValue(0.5);
$sheet->getCell('A1')->setValue("=ASINH($formula)"); $sheet->getCell('A1')->setValue("=ASINH($formula)");
$result = $sheet->getCell('A1')->getCalculatedValue(); $result = $sheet->getCell('A1')->getCalculatedValue();

View File

@ -12,7 +12,7 @@ class Atan2Test extends AllSetupTeardown
public function testATAN2($expectedResult, string $formula): void public function testATAN2($expectedResult, string $formula): void
{ {
$this->mightHaveException($expectedResult); $this->mightHaveException($expectedResult);
$sheet = $this->sheet; $sheet = $this->getSheet();
$sheet->getCell('A2')->setValue(5); $sheet->getCell('A2')->setValue(5);
$sheet->getCell('A3')->setValue(6); $sheet->getCell('A3')->setValue(6);
$sheet->getCell('A1')->setValue("=ATAN2($formula)"); $sheet->getCell('A1')->setValue("=ATAN2($formula)");

View File

@ -12,7 +12,7 @@ class AtanTest extends AllSetupTeardown
public function testAtan($expectedResult, string $formula): void public function testAtan($expectedResult, string $formula): void
{ {
$this->mightHaveException($expectedResult); $this->mightHaveException($expectedResult);
$sheet = $this->sheet; $sheet = $this->getSheet();
$sheet->getCell('A2')->setValue(5); $sheet->getCell('A2')->setValue(5);
$sheet->getCell('A1')->setValue("=ATAN($formula)"); $sheet->getCell('A1')->setValue("=ATAN($formula)");
$result = $sheet->getCell('A1')->getCalculatedValue(); $result = $sheet->getCell('A1')->getCalculatedValue();

View File

@ -12,7 +12,7 @@ class AtanhTest extends AllSetupTeardown
public function testAtanh($expectedResult, string $formula): void public function testAtanh($expectedResult, string $formula): void
{ {
$this->mightHaveException($expectedResult); $this->mightHaveException($expectedResult);
$sheet = $this->sheet; $sheet = $this->getSheet();
$sheet->getCell('A2')->setValue(0.8); $sheet->getCell('A2')->setValue(0.8);
$sheet->getCell('A1')->setValue("=ATANH($formula)"); $sheet->getCell('A1')->setValue("=ATANH($formula)");
$result = $sheet->getCell('A1')->getCalculatedValue(); $result = $sheet->getCell('A1')->getCalculatedValue();

View File

@ -15,7 +15,7 @@ class BaseTest extends AllSetupTeardown
public function testBASE($expectedResult, $arg1 = 'omitted', $arg2 = 'omitted', $arg3 = 'omitted'): void public function testBASE($expectedResult, $arg1 = 'omitted', $arg2 = 'omitted', $arg3 = 'omitted'): void
{ {
$this->mightHaveException($expectedResult); $this->mightHaveException($expectedResult);
$sheet = $this->sheet; $sheet = $this->getSheet();
if ($arg1 !== null) { if ($arg1 !== null) {
$sheet->getCell('A1')->setValue($arg1); $sheet->getCell('A1')->setValue($arg1);
} }

View File

@ -13,7 +13,7 @@ class CeilingMathTest extends AllSetupTeardown
public function testCEILINGMATH($expectedResult, $formula): void public function testCEILINGMATH($expectedResult, $formula): void
{ {
$this->mightHaveException($expectedResult); $this->mightHaveException($expectedResult);
$sheet = $this->sheet; $sheet = $this->getSheet();
$sheet->setCellValue('A2', 1.3); $sheet->setCellValue('A2', 1.3);
$sheet->setCellValue('A3', 2.7); $sheet->setCellValue('A3', 2.7);
$sheet->setCellValue('A4', -3.8); $sheet->setCellValue('A4', -3.8);

View File

@ -13,7 +13,7 @@ class CeilingPreciseTest extends AllSetupTeardown
public function testCEILINGPRECISE($expectedResult, $formula): void public function testCEILINGPRECISE($expectedResult, $formula): void
{ {
$this->mightHaveException($expectedResult); $this->mightHaveException($expectedResult);
$sheet = $this->sheet; $sheet = $this->getSheet();
$sheet->setCellValue('A2', 1.3); $sheet->setCellValue('A2', 1.3);
$sheet->setCellValue('A3', 2.7); $sheet->setCellValue('A3', 2.7);
$sheet->setCellValue('A4', -3.8); $sheet->setCellValue('A4', -3.8);

View File

@ -13,7 +13,7 @@ class CeilingTest extends AllSetupTeardown
public function testCEILING($expectedResult, $formula): void public function testCEILING($expectedResult, $formula): void
{ {
$this->mightHaveException($expectedResult); $this->mightHaveException($expectedResult);
$sheet = $this->sheet; $sheet = $this->getSheet();
$sheet->setCellValue('A2', 1.3); $sheet->setCellValue('A2', 1.3);
$sheet->setCellValue('A3', 2.7); $sheet->setCellValue('A3', 2.7);
$sheet->setCellValue('A4', -3.8); $sheet->setCellValue('A4', -3.8);
@ -31,7 +31,7 @@ class CeilingTest extends AllSetupTeardown
public function testCEILINGGnumeric1Arg(): void public function testCEILINGGnumeric1Arg(): void
{ {
self::setGnumeric(); self::setGnumeric();
$sheet = $this->sheet; $sheet = $this->getSheet();
$sheet->getCell('A1')->setValue('=CEILING(5.1)'); $sheet->getCell('A1')->setValue('=CEILING(5.1)');
$result = $sheet->getCell('A1')->getCalculatedValue(); $result = $sheet->getCell('A1')->getCalculatedValue();
self::assertEqualsWithDelta(6, $result, 1E-12); self::assertEqualsWithDelta(6, $result, 1E-12);
@ -40,7 +40,7 @@ class CeilingTest extends AllSetupTeardown
public function testCELINGOpenOffice1Arg(): void public function testCELINGOpenOffice1Arg(): void
{ {
self::setOpenOffice(); self::setOpenOffice();
$sheet = $this->sheet; $sheet = $this->getSheet();
$sheet->getCell('A1')->setValue('=CEILING(5.1)'); $sheet->getCell('A1')->setValue('=CEILING(5.1)');
$result = $sheet->getCell('A1')->getCalculatedValue(); $result = $sheet->getCell('A1')->getCalculatedValue();
self::assertEqualsWithDelta(6, $result, 1E-12); self::assertEqualsWithDelta(6, $result, 1E-12);
@ -49,7 +49,7 @@ class CeilingTest extends AllSetupTeardown
public function testCEILINGExcel1Arg(): void public function testCEILINGExcel1Arg(): void
{ {
$this->mightHaveException('exception'); $this->mightHaveException('exception');
$sheet = $this->sheet; $sheet = $this->getSheet();
$sheet->getCell('A1')->setValue('=CEILING(5.1)'); $sheet->getCell('A1')->setValue('=CEILING(5.1)');
$result = $sheet->getCell('A1')->getCalculatedValue(); $result = $sheet->getCell('A1')->getCalculatedValue();
self::assertEqualsWithDelta(6, $result, 1E-12); self::assertEqualsWithDelta(6, $result, 1E-12);

View File

@ -14,7 +14,7 @@ class CombinATest extends AllSetupTeardown
public function testCOMBINA($expectedResult, $numObjs, $numInSet): void public function testCOMBINA($expectedResult, $numObjs, $numInSet): void
{ {
$this->mightHaveException($expectedResult); $this->mightHaveException($expectedResult);
$sheet = $this->sheet; $sheet = $this->getSheet();
if ($numObjs !== null) { if ($numObjs !== null) {
$sheet->getCell('A1')->setValue($numObjs); $sheet->getCell('A1')->setValue($numObjs);
} }

View File

@ -14,7 +14,7 @@ class CombinTest extends AllSetupTeardown
public function testCOMBIN($expectedResult, $numObjs, $numInSet): void public function testCOMBIN($expectedResult, $numObjs, $numInSet): void
{ {
$this->mightHaveException($expectedResult); $this->mightHaveException($expectedResult);
$sheet = $this->sheet; $sheet = $this->getSheet();
if ($numObjs !== null) { if ($numObjs !== null) {
$sheet->getCell('A1')->setValue($numObjs); $sheet->getCell('A1')->setValue($numObjs);
} }

View File

@ -12,7 +12,7 @@ class CosTest extends AllSetupTeardown
public function testCos($expectedResult, string $formula): void public function testCos($expectedResult, string $formula): void
{ {
$this->mightHaveException($expectedResult); $this->mightHaveException($expectedResult);
$sheet = $this->sheet; $sheet = $this->getSheet();
$sheet->setCellValue('A2', 2); $sheet->setCellValue('A2', 2);
$sheet->getCell('A1')->setValue("=COS($formula)"); $sheet->getCell('A1')->setValue("=COS($formula)");
$result = $sheet->getCell('A1')->getCalculatedValue(); $result = $sheet->getCell('A1')->getCalculatedValue();

View File

@ -12,7 +12,7 @@ class CoshTest extends AllSetupTeardown
public function testCosh($expectedResult, string $formula): void public function testCosh($expectedResult, string $formula): void
{ {
$this->mightHaveException($expectedResult); $this->mightHaveException($expectedResult);
$sheet = $this->sheet; $sheet = $this->getSheet();
$sheet->setCellValue('A2', 2); $sheet->setCellValue('A2', 2);
$sheet->getCell('A1')->setValue("=COSH($formula)"); $sheet->getCell('A1')->setValue("=COSH($formula)");
$result = $sheet->getCell('A1')->getCalculatedValue(); $result = $sheet->getCell('A1')->getCalculatedValue();

View File

@ -13,7 +13,7 @@ class CotTest extends AllSetupTeardown
public function testCOT($expectedResult, $angle): void public function testCOT($expectedResult, $angle): void
{ {
$this->mightHaveException($expectedResult); $this->mightHaveException($expectedResult);
$sheet = $this->sheet; $sheet = $this->getSheet();
$sheet->setCellValue('A2', 1.3); $sheet->setCellValue('A2', 1.3);
$sheet->setCellValue('A3', 2.7); $sheet->setCellValue('A3', 2.7);
$sheet->setCellValue('A4', -3.8); $sheet->setCellValue('A4', -3.8);

View File

@ -13,7 +13,7 @@ class CothTest extends AllSetupTeardown
public function testCOTH($expectedResult, $angle): void public function testCOTH($expectedResult, $angle): void
{ {
$this->mightHaveException($expectedResult); $this->mightHaveException($expectedResult);
$sheet = $this->sheet; $sheet = $this->getSheet();
$sheet->setCellValue('A2', 1.3); $sheet->setCellValue('A2', 1.3);
$sheet->setCellValue('A3', 2.7); $sheet->setCellValue('A3', 2.7);
$sheet->setCellValue('A4', -3.8); $sheet->setCellValue('A4', -3.8);

View File

@ -13,7 +13,7 @@ class CscTest extends AllSetupTeardown
public function testCSC($expectedResult, $angle): void public function testCSC($expectedResult, $angle): void
{ {
$this->mightHaveException($expectedResult); $this->mightHaveException($expectedResult);
$sheet = $this->sheet; $sheet = $this->getSheet();
$sheet->setCellValue('A2', 1.3); $sheet->setCellValue('A2', 1.3);
$sheet->setCellValue('A3', 2.7); $sheet->setCellValue('A3', 2.7);
$sheet->setCellValue('A4', -3.8); $sheet->setCellValue('A4', -3.8);

View File

@ -13,7 +13,7 @@ class CschTest extends AllSetupTeardown
public function testCSCH($expectedResult, $angle): void public function testCSCH($expectedResult, $angle): void
{ {
$this->mightHaveException($expectedResult); $this->mightHaveException($expectedResult);
$sheet = $this->sheet; $sheet = $this->getSheet();
$sheet->setCellValue('A2', 1.3); $sheet->setCellValue('A2', 1.3);
$sheet->setCellValue('A3', 2.7); $sheet->setCellValue('A3', 2.7);
$sheet->setCellValue('A4', -3.8); $sheet->setCellValue('A4', -3.8);

View File

@ -12,7 +12,7 @@ class DegreesTest extends AllSetupTeardown
*/ */
public function testDegrees($expectedResult, $number = 'omitted'): void public function testDegrees($expectedResult, $number = 'omitted'): void
{ {
$sheet = $this->sheet; $sheet = $this->getSheet();
$this->mightHaveException($expectedResult); $this->mightHaveException($expectedResult);
$this->setCell('A1', $number); $this->setCell('A1', $number);
if ($number === 'omitted') { if ($number === 'omitted') {

View File

@ -13,7 +13,7 @@ class EvenTest extends AllSetupTeardown
public function testEVEN($expectedResult, $value): void public function testEVEN($expectedResult, $value): void
{ {
$this->mightHaveException($expectedResult); $this->mightHaveException($expectedResult);
$sheet = $this->sheet; $sheet = $this->getSheet();
$sheet->getCell('A1')->setValue("=EVEN($value)"); $sheet->getCell('A1')->setValue("=EVEN($value)");
$sheet->getCell('A2')->setValue(3.7); $sheet->getCell('A2')->setValue(3.7);
self::assertEquals($expectedResult, $sheet->getCell('A1')->getCalculatedValue()); self::assertEquals($expectedResult, $sheet->getCell('A1')->getCalculatedValue());

View File

@ -13,7 +13,7 @@ class ExpTest extends AllSetupTeardown
public function testEXP($expectedResult, $number = 'omitted'): void public function testEXP($expectedResult, $number = 'omitted'): void
{ {
$this->mightHaveException($expectedResult); $this->mightHaveException($expectedResult);
$sheet = $this->sheet; $sheet = $this->getSheet();
if ($number !== null) { if ($number !== null) {
$sheet->getCell('A1')->setValue($number); $sheet->getCell('A1')->setValue($number);
} }

View File

@ -13,7 +13,7 @@ class FactDoubleTest extends AllSetupTeardown
public function testFACTDOUBLE($expectedResult, $value): void public function testFACTDOUBLE($expectedResult, $value): void
{ {
$this->mightHaveException($expectedResult); $this->mightHaveException($expectedResult);
$sheet = $this->sheet; $sheet = $this->getSheet();
$sheet->getCell('A1')->setValue($value); $sheet->getCell('A1')->setValue($value);
$sheet->getCell('B1')->setValue('=FACTDOUBLE(A1)'); $sheet->getCell('B1')->setValue('=FACTDOUBLE(A1)');
$result = $sheet->getCell('B1')->getCalculatedValue(); $result = $sheet->getCell('B1')->getCalculatedValue();

View File

@ -13,7 +13,7 @@ class FactTest extends AllSetupTeardown
public function testFACT($expectedResult, $arg1): void public function testFACT($expectedResult, $arg1): void
{ {
$this->mightHaveException($expectedResult); $this->mightHaveException($expectedResult);
$sheet = $this->sheet; $sheet = $this->getSheet();
if ($arg1 !== null) { if ($arg1 !== null) {
$sheet->getCell('A1')->setValue($arg1); $sheet->getCell('A1')->setValue($arg1);
} }
@ -41,7 +41,7 @@ class FactTest extends AllSetupTeardown
{ {
$this->mightHaveException($expectedResult); $this->mightHaveException($expectedResult);
self::setGnumeric(); self::setGnumeric();
$sheet = $this->sheet; $sheet = $this->getSheet();
if ($arg1 !== null) { if ($arg1 !== null) {
$sheet->getCell('A1')->setValue($arg1); $sheet->getCell('A1')->setValue($arg1);
} }

View File

@ -13,7 +13,7 @@ class FloorMathTest extends AllSetupTeardown
public function testFLOORMATH($expectedResult, $formula): void public function testFLOORMATH($expectedResult, $formula): void
{ {
$this->mightHaveException($expectedResult); $this->mightHaveException($expectedResult);
$sheet = $this->sheet; $sheet = $this->getSheet();
$sheet->setCellValue('A2', 1.3); $sheet->setCellValue('A2', 1.3);
$sheet->setCellValue('A3', 2.7); $sheet->setCellValue('A3', 2.7);
$sheet->setCellValue('A4', -3.8); $sheet->setCellValue('A4', -3.8);

View File

@ -13,7 +13,7 @@ class FloorPreciseTest extends AllSetupTeardown
public function testFLOORPRECISE($expectedResult, $formula): void public function testFLOORPRECISE($expectedResult, $formula): void
{ {
$this->mightHaveException($expectedResult); $this->mightHaveException($expectedResult);
$sheet = $this->sheet; $sheet = $this->getSheet();
$sheet->setCellValue('A2', 1.3); $sheet->setCellValue('A2', 1.3);
$sheet->setCellValue('A3', 2.7); $sheet->setCellValue('A3', 2.7);
$sheet->setCellValue('A4', -3.8); $sheet->setCellValue('A4', -3.8);

View File

@ -13,7 +13,7 @@ class FloorTest extends AllSetupTeardown
public function testFLOOR($expectedResult, $formula): void public function testFLOOR($expectedResult, $formula): void
{ {
$this->mightHaveException($expectedResult); $this->mightHaveException($expectedResult);
$sheet = $this->sheet; $sheet = $this->getSheet();
$sheet->setCellValue('A2', 1.3); $sheet->setCellValue('A2', 1.3);
$sheet->setCellValue('A3', 2.7); $sheet->setCellValue('A3', 2.7);
$sheet->setCellValue('A4', -3.8); $sheet->setCellValue('A4', -3.8);
@ -31,7 +31,7 @@ class FloorTest extends AllSetupTeardown
public function testFLOORGnumeric1Arg(): void public function testFLOORGnumeric1Arg(): void
{ {
self::setGnumeric(); self::setGnumeric();
$sheet = $this->sheet; $sheet = $this->getSheet();
$sheet->getCell('A1')->setValue('=FLOOR(5.1)'); $sheet->getCell('A1')->setValue('=FLOOR(5.1)');
$result = $sheet->getCell('A1')->getCalculatedValue(); $result = $sheet->getCell('A1')->getCalculatedValue();
self::assertEqualsWithDelta(5, $result, 1E-12); self::assertEqualsWithDelta(5, $result, 1E-12);
@ -40,7 +40,7 @@ class FloorTest extends AllSetupTeardown
public function testFLOOROpenOffice1Arg(): void public function testFLOOROpenOffice1Arg(): void
{ {
self::setOpenOffice(); self::setOpenOffice();
$sheet = $this->sheet; $sheet = $this->getSheet();
$sheet->getCell('A1')->setValue('=FLOOR(5.1)'); $sheet->getCell('A1')->setValue('=FLOOR(5.1)');
$result = $sheet->getCell('A1')->getCalculatedValue(); $result = $sheet->getCell('A1')->getCalculatedValue();
self::assertEqualsWithDelta(5, $result, 1E-12); self::assertEqualsWithDelta(5, $result, 1E-12);
@ -49,7 +49,7 @@ class FloorTest extends AllSetupTeardown
public function testFLOORExcel1Arg(): void public function testFLOORExcel1Arg(): void
{ {
$this->mightHaveException('exception'); $this->mightHaveException('exception');
$sheet = $this->sheet; $sheet = $this->getSheet();
$sheet->getCell('A1')->setValue('=FLOOR(5.1)'); $sheet->getCell('A1')->setValue('=FLOOR(5.1)');
$result = $sheet->getCell('A1')->getCalculatedValue(); $result = $sheet->getCell('A1')->getCalculatedValue();
self::assertEqualsWithDelta(5, $result, 1E-12); self::assertEqualsWithDelta(5, $result, 1E-12);

View File

@ -12,7 +12,7 @@ class GcdTest extends AllSetupTeardown
public function testGCD($expectedResult, ...$args): void public function testGCD($expectedResult, ...$args): void
{ {
$this->mightHaveException($expectedResult); $this->mightHaveException($expectedResult);
$sheet = $this->sheet; $sheet = $this->getSheet();
$row = 0; $row = 0;
foreach ($args as $arg) { foreach ($args as $arg) {
++$row; ++$row;

View File

@ -13,7 +13,7 @@ class IntTest extends AllSetupTeardown
public function testINT($expectedResult, $formula): void public function testINT($expectedResult, $formula): void
{ {
$this->mightHaveException($expectedResult); $this->mightHaveException($expectedResult);
$sheet = $this->sheet; $sheet = $this->getSheet();
$sheet->setCellValue('A2', 1.3); $sheet->setCellValue('A2', 1.3);
$sheet->setCellValue('A3', 2.7); $sheet->setCellValue('A3', 2.7);
$sheet->setCellValue('A4', -3.8); $sheet->setCellValue('A4', -3.8);

View File

@ -11,7 +11,7 @@ class LcmTest extends AllSetupTeardown
*/ */
public function testLCM($expectedResult, ...$args): void public function testLCM($expectedResult, ...$args): void
{ {
$sheet = $this->sheet; $sheet = $this->getSheet();
$row = 0; $row = 0;
foreach ($args as $arg) { foreach ($args as $arg) {
++$row; ++$row;

View File

@ -13,7 +13,7 @@ class LnTest extends AllSetupTeardown
public function testLN($expectedResult, $number = 'omitted'): void public function testLN($expectedResult, $number = 'omitted'): void
{ {
$this->mightHaveException($expectedResult); $this->mightHaveException($expectedResult);
$sheet = $this->sheet; $sheet = $this->getSheet();
if ($number !== null) { if ($number !== null) {
$sheet->getCell('A1')->setValue($number); $sheet->getCell('A1')->setValue($number);
} }

View File

@ -13,7 +13,7 @@ class Log10Test extends AllSetupTeardown
public function testLN($expectedResult, $number = 'omitted'): void public function testLN($expectedResult, $number = 'omitted'): void
{ {
$this->mightHaveException($expectedResult); $this->mightHaveException($expectedResult);
$sheet = $this->sheet; $sheet = $this->getSheet();
if ($number !== null) { if ($number !== null) {
$sheet->getCell('A1')->setValue($number); $sheet->getCell('A1')->setValue($number);
} }

View File

@ -14,7 +14,7 @@ class LogTest extends AllSetupTeardown
public function testLOG($expectedResult, $number = 'omitted', $base = 'omitted'): void public function testLOG($expectedResult, $number = 'omitted', $base = 'omitted'): void
{ {
$this->mightHaveException($expectedResult); $this->mightHaveException($expectedResult);
$sheet = $this->sheet; $sheet = $this->getSheet();
if ($number !== null) { if ($number !== null) {
$sheet->getCell('A1')->setValue($number); $sheet->getCell('A1')->setValue($number);
} }

View File

@ -25,7 +25,7 @@ class MInverseTest extends AllSetupTeardown
public function testOnSpreadsheet(): void public function testOnSpreadsheet(): void
{ {
// very limited ability to test this in the absence of dynamic arrays // very limited ability to test this in the absence of dynamic arrays
$sheet = $this->sheet; $sheet = $this->getSheet();
$sheet->getCell('A1')->setValue('=MINVERSE({1,2,3})'); // not square $sheet->getCell('A1')->setValue('=MINVERSE({1,2,3})'); // not square
self::assertSame('#VALUE!', $sheet->getCell('A1')->getCalculatedValue()); self::assertSame('#VALUE!', $sheet->getCell('A1')->getCalculatedValue());
} }

View File

@ -25,7 +25,7 @@ class MMultTest extends AllSetupTeardown
public function testOnSpreadsheet(): void public function testOnSpreadsheet(): void
{ {
// very limited ability to test this in the absence of dynamic arrays // very limited ability to test this in the absence of dynamic arrays
$sheet = $this->sheet; $sheet = $this->getSheet();
$sheet->getCell('A1')->setValue('=MMULT({1,2,3}, {1,2,3})'); // incompatible dimensions $sheet->getCell('A1')->setValue('=MMULT({1,2,3}, {1,2,3})'); // incompatible dimensions
self::assertSame('#VALUE!', $sheet->getCell('A1')->getCalculatedValue()); self::assertSame('#VALUE!', $sheet->getCell('A1')->getCalculatedValue());

View File

@ -13,7 +13,7 @@ class MRoundTest extends AllSetupTeardown
public function testMROUND($expectedResult, $formula): void public function testMROUND($expectedResult, $formula): void
{ {
$this->mightHaveException($expectedResult); $this->mightHaveException($expectedResult);
$sheet = $this->sheet; $sheet = $this->getSheet();
$sheet->setCellValue('A2', 1.3); $sheet->setCellValue('A2', 1.3);
$sheet->setCellValue('A3', 2.7); $sheet->setCellValue('A3', 2.7);
$sheet->setCellValue('A4', -3.8); $sheet->setCellValue('A4', -3.8);

View File

@ -13,7 +13,7 @@ class MdeTermTest extends AllSetupTeardown
public function testMDETERM2($expectedResult, $matrix): void public function testMDETERM2($expectedResult, $matrix): void
{ {
$this->mightHaveException($expectedResult); $this->mightHaveException($expectedResult);
$sheet = $this->sheet; $sheet = $this->getSheet();
if (is_array($matrix)) { if (is_array($matrix)) {
$sheet->fromArray($matrix, null, 'A1', true); $sheet->fromArray($matrix, null, 'A1', true);
$maxCol = $sheet->getHighestColumn(); $maxCol = $sheet->getHighestColumn();

View File

@ -14,7 +14,7 @@ class ModTest extends AllSetupTeardown
public function testMOD($expectedResult, $dividend = 'omitted', $divisor = 'omitted'): void public function testMOD($expectedResult, $dividend = 'omitted', $divisor = 'omitted'): void
{ {
$this->mightHaveException($expectedResult); $this->mightHaveException($expectedResult);
$sheet = $this->sheet; $sheet = $this->getSheet();
if ($dividend !== null) { if ($dividend !== null) {
$sheet->getCell('A1')->setValue($dividend); $sheet->getCell('A1')->setValue($dividend);
} }

View File

@ -12,7 +12,7 @@ class MultinomialTest extends AllSetupTeardown
public function testMULTINOMIAL($expectedResult, ...$args): void public function testMULTINOMIAL($expectedResult, ...$args): void
{ {
$this->mightHaveException($expectedResult); $this->mightHaveException($expectedResult);
$sheet = $this->sheet; $sheet = $this->getSheet();
$row = 0; $row = 0;
$excelArg = ''; $excelArg = '';
foreach ($args as $arg) { foreach ($args as $arg) {

View File

@ -13,7 +13,7 @@ class OddTest extends AllSetupTeardown
public function testODD($expectedResult, $value): void public function testODD($expectedResult, $value): void
{ {
$this->mightHaveException($expectedResult); $this->mightHaveException($expectedResult);
$sheet = $this->sheet; $sheet = $this->getSheet();
$sheet->getCell('A1')->setValue("=ODD($value)"); $sheet->getCell('A1')->setValue("=ODD($value)");
$sheet->getCell('A2')->setValue(3.7); $sheet->getCell('A2')->setValue(3.7);
self::assertEquals($expectedResult, $sheet->getCell('A1')->getCalculatedValue()); self::assertEquals($expectedResult, $sheet->getCell('A1')->getCalculatedValue());

View File

@ -14,7 +14,7 @@ class PowerTest extends AllSetupTeardown
public function testPOWER($expectedResult, $base = 'omitted', $exponent = 'omitted'): void public function testPOWER($expectedResult, $base = 'omitted', $exponent = 'omitted'): void
{ {
$this->mightHaveException($expectedResult); $this->mightHaveException($expectedResult);
$sheet = $this->sheet; $sheet = $this->getSheet();
if ($base !== null) { if ($base !== null) {
$sheet->getCell('A1')->setValue($base); $sheet->getCell('A1')->setValue($base);
} }

View File

@ -11,7 +11,7 @@ class ProductTest extends AllSetupTeardown
*/ */
public function testPRODUCT($expectedResult, ...$args): void public function testPRODUCT($expectedResult, ...$args): void
{ {
$sheet = $this->sheet; $sheet = $this->getSheet();
$row = 0; $row = 0;
foreach ($args as $arg) { foreach ($args as $arg) {
++$row; ++$row;

View File

@ -14,7 +14,7 @@ class QuotientTest extends AllSetupTeardown
public function testQUOTIENT($expectedResult, $arg1 = 'omitted', $arg2 = 'omitted'): void public function testQUOTIENT($expectedResult, $arg1 = 'omitted', $arg2 = 'omitted'): void
{ {
$this->mightHaveException($expectedResult); $this->mightHaveException($expectedResult);
$sheet = $this->sheet; $sheet = $this->getSheet();
if ($arg1 !== null) { if ($arg1 !== null) {
$sheet->getCell('A1')->setValue($arg1); $sheet->getCell('A1')->setValue($arg1);
} }

View File

@ -12,7 +12,7 @@ class RadiansTest extends AllSetupTeardown
*/ */
public function testRADIANS($expectedResult, $number = 'omitted'): void public function testRADIANS($expectedResult, $number = 'omitted'): void
{ {
$sheet = $this->sheet; $sheet = $this->getSheet();
$this->mightHaveException($expectedResult); $this->mightHaveException($expectedResult);
$this->setCell('A1', $number); $this->setCell('A1', $number);
if ($number === 'omitted') { if ($number === 'omitted') {

View File

@ -14,7 +14,7 @@ class RandBetweenTest extends AllSetupTeardown
public function testRANDBETWEEN($expectedResult, $min = 'omitted', $max = 'omitted'): void public function testRANDBETWEEN($expectedResult, $min = 'omitted', $max = 'omitted'): void
{ {
$this->mightHaveException($expectedResult); $this->mightHaveException($expectedResult);
$sheet = $this->sheet; $sheet = $this->getSheet();
$lower = (int) $min; $lower = (int) $min;
$upper = (int) $max; $upper = (int) $max;
if ($min !== null) { if ($min !== null) {

View File

@ -6,7 +6,7 @@ class RandTest extends AllSetupTeardown
{ {
public function testRand(): void public function testRand(): void
{ {
$sheet = $this->sheet; $sheet = $this->getSheet();
$sheet->getCell('B1')->setValue('=RAND()'); $sheet->getCell('B1')->setValue('=RAND()');
$result = $sheet->getCell('B1')->getCalculatedValue(); $result = $sheet->getCell('B1')->getCalculatedValue();
self::assertGreaterThanOrEqual(0, $result); self::assertGreaterThanOrEqual(0, $result);
@ -16,7 +16,7 @@ class RandTest extends AllSetupTeardown
public function testRandException(): void public function testRandException(): void
{ {
$this->mightHaveException('exception'); $this->mightHaveException('exception');
$sheet = $this->sheet; $sheet = $this->getSheet();
$sheet->getCell('B1')->setValue('=RAND(A1)'); $sheet->getCell('B1')->setValue('=RAND(A1)');
$result = $sheet->getCell('B1')->getCalculatedValue(); $result = $sheet->getCell('B1')->getCalculatedValue();
self::assertEquals(0, $result); self::assertEquals(0, $result);

View File

@ -13,7 +13,7 @@ class RomanTest extends AllSetupTeardown
public function testROMAN($expectedResult, $formula): void public function testROMAN($expectedResult, $formula): void
{ {
$this->mightHaveException($expectedResult); $this->mightHaveException($expectedResult);
$sheet = $this->sheet; $sheet = $this->getSheet();
$sheet->setCellValue('A3', 49); $sheet->setCellValue('A3', 49);
$sheet->getCell('A1')->setValue("=ROMAN($formula)"); $sheet->getCell('A1')->setValue("=ROMAN($formula)");
$result = $sheet->getCell('A1')->getCalculatedValue(); $result = $sheet->getCell('A1')->getCalculatedValue();

View File

@ -13,7 +13,7 @@ class RoundDownTest extends AllSetupTeardown
public function testRoundDown($expectedResult, $formula): void public function testRoundDown($expectedResult, $formula): void
{ {
$this->mightHaveException($expectedResult); $this->mightHaveException($expectedResult);
$sheet = $this->sheet; $sheet = $this->getSheet();
$sheet->setCellValue('A2', 1.3); $sheet->setCellValue('A2', 1.3);
$sheet->setCellValue('A3', 2.7); $sheet->setCellValue('A3', 2.7);
$sheet->setCellValue('A4', -3.8); $sheet->setCellValue('A4', -3.8);

View File

@ -13,7 +13,7 @@ class RoundTest extends AllSetupTeardown
public function testRound($expectedResult, $formula): void public function testRound($expectedResult, $formula): void
{ {
$this->mightHaveException($expectedResult); $this->mightHaveException($expectedResult);
$sheet = $this->sheet; $sheet = $this->getSheet();
$sheet->setCellValue('A2', 1.3); $sheet->setCellValue('A2', 1.3);
$sheet->setCellValue('A3', 2.7); $sheet->setCellValue('A3', 2.7);
$sheet->setCellValue('A4', -3.8); $sheet->setCellValue('A4', -3.8);

View File

@ -13,7 +13,7 @@ class RoundUpTest extends AllSetupTeardown
public function testRoundUp($expectedResult, $formula): void public function testRoundUp($expectedResult, $formula): void
{ {
$this->mightHaveException($expectedResult); $this->mightHaveException($expectedResult);
$sheet = $this->sheet; $sheet = $this->getSheet();
$sheet->setCellValue('A2', 1.3); $sheet->setCellValue('A2', 1.3);
$sheet->setCellValue('A3', 2.7); $sheet->setCellValue('A3', 2.7);
$sheet->setCellValue('A4', -3.8); $sheet->setCellValue('A4', -3.8);

View File

@ -13,7 +13,7 @@ class SecTest extends AllSetupTeardown
public function testSEC($expectedResult, $angle): void public function testSEC($expectedResult, $angle): void
{ {
$this->mightHaveException($expectedResult); $this->mightHaveException($expectedResult);
$sheet = $this->sheet; $sheet = $this->getSheet();
$sheet->setCellValue('A2', 1.3); $sheet->setCellValue('A2', 1.3);
$sheet->setCellValue('A3', 2.7); $sheet->setCellValue('A3', 2.7);
$sheet->setCellValue('A4', -3.8); $sheet->setCellValue('A4', -3.8);

View File

@ -13,7 +13,7 @@ class SechTest extends AllSetupTeardown
public function testSECH($expectedResult, $angle): void public function testSECH($expectedResult, $angle): void
{ {
$this->mightHaveException($expectedResult); $this->mightHaveException($expectedResult);
$sheet = $this->sheet; $sheet = $this->getSheet();
$sheet->setCellValue('A2', 1.3); $sheet->setCellValue('A2', 1.3);
$sheet->setCellValue('A3', 2.7); $sheet->setCellValue('A3', 2.7);
$sheet->setCellValue('A4', -3.8); $sheet->setCellValue('A4', -3.8);

View File

@ -16,7 +16,7 @@ class SeriesSumTest extends AllSetupTeardown
*/ */
public function testSERIESSUM($expectedResult, $arg1, $arg2, $arg3, ...$args): void public function testSERIESSUM($expectedResult, $arg1, $arg2, $arg3, ...$args): void
{ {
$sheet = $this->sheet; $sheet = $this->getSheet();
if ($arg1 !== null) { if ($arg1 !== null) {
$sheet->getCell('C1')->setValue($arg1); $sheet->getCell('C1')->setValue($arg1);
} }

View File

@ -13,7 +13,7 @@ class SignTest extends AllSetupTeardown
public function testSIGN($expectedResult, $value): void public function testSIGN($expectedResult, $value): void
{ {
$this->mightHaveException($expectedResult); $this->mightHaveException($expectedResult);
$sheet = $this->sheet; $sheet = $this->getSheet();
$sheet->setCellValue('A2', 1.3); $sheet->setCellValue('A2', 1.3);
$sheet->setCellValue('A3', 0); $sheet->setCellValue('A3', 0);
$sheet->setCellValue('A4', -3.8); $sheet->setCellValue('A4', -3.8);

View File

@ -12,7 +12,7 @@ class SinTest extends AllSetupTeardown
public function testSin($expectedResult, string $formula): void public function testSin($expectedResult, string $formula): void
{ {
$this->mightHaveException($expectedResult); $this->mightHaveException($expectedResult);
$sheet = $this->sheet; $sheet = $this->getSheet();
$sheet->setCellValue('A2', 2); $sheet->setCellValue('A2', 2);
$sheet->getCell('A1')->setValue("=SIN($formula)"); $sheet->getCell('A1')->setValue("=SIN($formula)");
$result = $sheet->getCell('A1')->getCalculatedValue(); $result = $sheet->getCell('A1')->getCalculatedValue();

View File

@ -12,7 +12,7 @@ class SinhTest extends AllSetupTeardown
public function testSinh($expectedResult, string $formula): void public function testSinh($expectedResult, string $formula): void
{ {
$this->mightHaveException($expectedResult); $this->mightHaveException($expectedResult);
$sheet = $this->sheet; $sheet = $this->getSheet();
$sheet->setCellValue('A2', 2); $sheet->setCellValue('A2', 2);
$sheet->getCell('A1')->setValue("=SINH($formula)"); $sheet->getCell('A1')->setValue("=SINH($formula)");
$result = $sheet->getCell('A1')->getCalculatedValue(); $result = $sheet->getCell('A1')->getCalculatedValue();

View File

@ -13,7 +13,7 @@ class SqrtPiTest extends AllSetupTeardown
public function testSQRTPI($expectedResult, $number): void public function testSQRTPI($expectedResult, $number): void
{ {
$this->mightHaveException($expectedResult); $this->mightHaveException($expectedResult);
$sheet = $this->sheet; $sheet = $this->getSheet();
if ($number !== null) { if ($number !== null) {
$sheet->getCell('A1')->setValue($number); $sheet->getCell('A1')->setValue($number);
} }

View File

@ -12,7 +12,7 @@ class SqrtTest extends AllSetupTeardown
*/ */
public function testSQRT($expectedResult, $number = 'omitted'): void public function testSQRT($expectedResult, $number = 'omitted'): void
{ {
$sheet = $this->sheet; $sheet = $this->getSheet();
$this->mightHaveException($expectedResult); $this->mightHaveException($expectedResult);
$this->setCell('A1', $number); $this->setCell('A1', $number);
if ($number === 'omitted') { if ($number === 'omitted') {

View File

@ -13,7 +13,7 @@ class SubTotalTest extends AllSetupTeardown
public function testSubtotal($expectedResult, $type): void public function testSubtotal($expectedResult, $type): void
{ {
$this->mightHaveException($expectedResult); $this->mightHaveException($expectedResult);
$sheet = $this->sheet; $sheet = $this->getSheet();
$sheet->fromArray([[0], [1], [1], [2], [3], [5], [8], [13], [21], [34], [55], [89]], null, 'A1', true); $sheet->fromArray([[0], [1], [1], [2], [3], [5], [8], [13], [21], [34], [55], [89]], null, 'A1', true);
$maxCol = $sheet->getHighestColumn(); $maxCol = $sheet->getHighestColumn();
$maxRow = $sheet->getHighestRow(); $maxRow = $sheet->getHighestRow();
@ -37,7 +37,7 @@ class SubTotalTest extends AllSetupTeardown
{ {
// Hidden columns don't affect calculation, only hidden rows // Hidden columns don't affect calculation, only hidden rows
$this->mightHaveException($expectedResult); $this->mightHaveException($expectedResult);
$sheet = $this->sheet; $sheet = $this->getSheet();
$sheet->fromArray([0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89], null, 'A1', true); $sheet->fromArray([0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89], null, 'A1', true);
$maxCol = $sheet->getHighestColumn(); $maxCol = $sheet->getHighestColumn();
$maxRow = $sheet->getHighestRow(); $maxRow = $sheet->getHighestRow();
@ -73,7 +73,7 @@ class SubTotalTest extends AllSetupTeardown
public function testSubtotalRowHidden($expectedResult, $type): void public function testSubtotalRowHidden($expectedResult, $type): void
{ {
$this->mightHaveException($expectedResult); $this->mightHaveException($expectedResult);
$sheet = $this->sheet; $sheet = $this->getSheet();
$sheet->fromArray([[0], [1], [1], [2], [3], [5], [8], [13], [21], [34], [55], [89]], null, 'A1', true); $sheet->fromArray([[0], [1], [1], [2], [3], [5], [8], [13], [21], [34], [55], [89]], null, 'A1', true);
$maxCol = $sheet->getHighestColumn(); $maxCol = $sheet->getHighestColumn();
$maxRow = $sheet->getHighestRow(); $maxRow = $sheet->getHighestRow();
@ -107,7 +107,7 @@ class SubTotalTest extends AllSetupTeardown
public function testSubtotalNested(): void public function testSubtotalNested(): void
{ {
$sheet = $this->sheet; $sheet = $this->getSheet();
$sheet->fromArray( $sheet->fromArray(
[ [
[123], [123],

View File

@ -16,7 +16,7 @@ class SumIfTest extends AllSetupTeardown
if ($expectedResult === 'incomplete') { if ($expectedResult === 'incomplete') {
self::markTestIncomplete('Raises formula error - researching solution'); self::markTestIncomplete('Raises formula error - researching solution');
} }
$sheet = $this->sheet; $sheet = $this->getSheet();
$sheet->fromArray($array1, null, 'A1', true); $sheet->fromArray($array1, null, 'A1', true);
$maxARow = count($array1); $maxARow = count($array1);
$firstArg = "A1:A$maxARow"; $firstArg = "A1:A$maxARow";

View File

@ -13,7 +13,7 @@ class SumProductTest extends AllSetupTeardown
*/ */
public function testSUMPRODUCT($expectedResult, ...$args): void public function testSUMPRODUCT($expectedResult, ...$args): void
{ {
$sheet = $this->sheet; $sheet = $this->getSheet();
$row = 0; $row = 0;
$arrayArg = ''; $arrayArg = '';
foreach ($args as $arr) { foreach ($args as $arr) {

View File

@ -14,7 +14,7 @@ class SumSqTest extends AllSetupTeardown
$this->mightHaveException($expectedResult); $this->mightHaveException($expectedResult);
$maxRow = 0; $maxRow = 0;
$funcArg = ''; $funcArg = '';
$sheet = $this->sheet; $sheet = $this->getSheet();
foreach ($args as $arg) { foreach ($args as $arg) {
++$maxRow; ++$maxRow;
$funcArg = "A1:A$maxRow"; $funcArg = "A1:A$maxRow";

View File

@ -11,7 +11,7 @@ class SumTest extends AllSetupTeardown
*/ */
public function testSUM($expectedResult, ...$args): void public function testSUM($expectedResult, ...$args): void
{ {
$sheet = $this->sheet; $sheet = $this->getSheet();
$row = 0; $row = 0;
foreach ($args as $arg) { foreach ($args as $arg) {
++$row; ++$row;

View File

@ -14,7 +14,7 @@ class SumX2MY2Test extends AllSetupTeardown
public function testSUMX2MY2($expectedResult, array $matrixData1, array $matrixData2): void public function testSUMX2MY2($expectedResult, array $matrixData1, array $matrixData2): void
{ {
$this->mightHaveException($expectedResult); $this->mightHaveException($expectedResult);
$sheet = $this->sheet; $sheet = $this->getSheet();
$maxRow = 0; $maxRow = 0;
$funcArg1 = ''; $funcArg1 = '';
foreach (Functions::flattenArray($matrixData1) as $arg) { foreach (Functions::flattenArray($matrixData1) as $arg) {

View File

@ -14,7 +14,7 @@ class SumX2PY2Test extends AllSetupTeardown
public function testSUMX2PY2($expectedResult, array $matrixData1, array $matrixData2): void public function testSUMX2PY2($expectedResult, array $matrixData1, array $matrixData2): void
{ {
$this->mightHaveException($expectedResult); $this->mightHaveException($expectedResult);
$sheet = $this->sheet; $sheet = $this->getSheet();
$maxRow = 0; $maxRow = 0;
$funcArg1 = ''; $funcArg1 = '';
foreach (Functions::flattenArray($matrixData1) as $arg) { foreach (Functions::flattenArray($matrixData1) as $arg) {

View File

@ -14,7 +14,7 @@ class SumXMY2Test extends AllSetupTeardown
public function testSUMXMY2($expectedResult, array $matrixData1, array $matrixData2): void public function testSUMXMY2($expectedResult, array $matrixData1, array $matrixData2): void
{ {
$this->mightHaveException($expectedResult); $this->mightHaveException($expectedResult);
$sheet = $this->sheet; $sheet = $this->getSheet();
$maxRow = 0; $maxRow = 0;
$funcArg1 = ''; $funcArg1 = '';
foreach (Functions::flattenArray($matrixData1) as $arg) { foreach (Functions::flattenArray($matrixData1) as $arg) {

View File

@ -12,7 +12,7 @@ class TanTest extends AllSetupTeardown
public function testTan($expectedResult, string $formula): void public function testTan($expectedResult, string $formula): void
{ {
$this->mightHaveException($expectedResult); $this->mightHaveException($expectedResult);
$sheet = $this->sheet; $sheet = $this->getSheet();
$sheet->setCellValue('A2', 1); $sheet->setCellValue('A2', 1);
$sheet->getCell('A1')->setValue("=TAN($formula)"); $sheet->getCell('A1')->setValue("=TAN($formula)");
$result = $sheet->getCell('A1')->getCalculatedValue(); $result = $sheet->getCell('A1')->getCalculatedValue();

View File

@ -12,7 +12,7 @@ class TanhTest extends AllSetupTeardown
public function testTanh($expectedResult, string $formula): void public function testTanh($expectedResult, string $formula): void
{ {
$this->mightHaveException($expectedResult); $this->mightHaveException($expectedResult);
$sheet = $this->sheet; $sheet = $this->getSheet();
$sheet->setCellValue('A2', 1); $sheet->setCellValue('A2', 1);
$sheet->getCell('A1')->setValue("=TANH($formula)"); $sheet->getCell('A1')->setValue("=TANH($formula)");
$result = $sheet->getCell('A1')->getCalculatedValue(); $result = $sheet->getCell('A1')->getCalculatedValue();

View File

@ -13,7 +13,7 @@ class TruncTest extends AllSetupTeardown
public function testTRUNC($expectedResult, $formula): void public function testTRUNC($expectedResult, $formula): void
{ {
$this->mightHaveException($expectedResult); $this->mightHaveException($expectedResult);
$sheet = $this->sheet; $sheet = $this->getSheet();
$sheet->setCellValue('A2', 1.3); $sheet->setCellValue('A2', 1.3);
$sheet->setCellValue('A3', 2.7); $sheet->setCellValue('A3', 2.7);
$sheet->setCellValue('A4', -3.8); $sheet->setCellValue('A4', -3.8);