add($fraction);
$writer = new OfficeMathML();
$output = $writer->write($math);
$expected = ''
. ''
. ''
. 'π'
. '2'
. ''
. ''
. '';
$this->assertEquals($expected, $output);
}
public function testWriteRow(): void
{
$math = new Math();
$row = new Element\Row();
$math->add($row);
$row->add(new Element\Identifier('x'));
$writer = new OfficeMathML();
$output = $writer->write($math);
$expected = ''
. ''
. 'x'
. ''
. '';
$this->assertEquals($expected, $output);
}
public function testWriteNotImplemented(): void
{
$this->expectException(NotImplementedException::class);
if (method_exists($this, 'expectExceptionMessageRegExp')) {
$this->expectExceptionMessageRegExp('/PhpOffice\\\Math\\\Writer\\\OfficeMathML::getElementTagName : The element of the class/');
$this->expectExceptionMessageRegExp('/has no tag name/');
} else {
// @phpstan-ignore-next-line
$this->expectExceptionMessageMatches('/PhpOffice\\\Math\\\Writer\\\OfficeMathML::getElementTagName : The element of the class/');
// @phpstan-ignore-next-line
$this->expectExceptionMessageMatches('/has no tag name/');
}
$math = new Math();
$object = new class() extends Element\AbstractElement {};
$math->add($object);
$writer = new OfficeMathML();
$output = $writer->write($math);
}
}