getValue()); } public function testFormattedValueWithInvalidValue(): void { $this->expectException(\InvalidArgumentException::class); $this->expectExceptionMessage('Unsupported value given, only string is supported'); $spreadsheet = new Spreadsheet(); $worksheet = $spreadsheet->getActiveSheet(); $sut = $this->getFormatter(); $sut->setFormattedValue($worksheet, 1, 1, 4711); } public function testWithDDEPayload(): void { $sut = $this->getFormatter(); $spreadsheet = new Spreadsheet(); $worksheet = $spreadsheet->getActiveSheet(); foreach (StringHelperTest::getDdeAttackStrings() as $attackString) { $value = $attackString[0]; // PHPOffice converts that, so simply skip it if (!str_contains($value, "\r")) { $sut->setFormattedValue($worksheet, 1, 1, $value); $cell = $worksheet->getCell([1, 1]); self::assertEquals("' " . $value, $cell->getValue()); } } } }