startElement('element');
$object->text('AAA');
$object->endElement();
$this->assertEquals('AAA'.chr(10), $object->getData());
// Disk
$object = new XMLWriter(XMLWriter::STORAGE_DISK);
$object->startElement('element');
$object->text('BBB');
$object->endElement();
$this->assertEquals('BBB'.chr(10), $object->getData());
}
public function testWriteAttribute()
{
$xmlWriter = new XMLWriter();
$xmlWriter->startElement('element');
$xmlWriter->writeAttribute('name', 'value');
$xmlWriter->endElement();
$this->assertSame('' . chr(10), $xmlWriter->getData());
}
public function testWriteAttributeShouldWriteFloatValueLocaleIndependent()
{
$value = 1.2;
$xmlWriter = new XMLWriter();
$xmlWriter->startElement('element');
$xmlWriter->writeAttribute('name', $value);
$xmlWriter->endElement();
setlocale(LC_NUMERIC, 'de_DE.UTF-8', 'de');
$this->assertSame('1,2', (string)$value);
$this->assertSame('' . chr(10), $xmlWriter->getData());
}
}