php-8.3.3-mac/lib/php/pear/test/XML_Util/tests/GetXmlDeclarationTests.php

39 lines
1.1 KiB
PHP
Raw Normal View History

2024-03-11 14:31:54 +03:00
<?php
class GetXMLDeclarationTests extends AbstractUnitTests
{
/**
* @covers XML_Util::getXMLDeclaration()
*/
public function testGetXMLDeclarationUsingVersion()
{
$version = "1.0";
$expected = "<?xml version=\"1.0\"?>";
$this->assertEquals($expected, XML_Util::getXMLDeclaration($version));
}
/**
* @covers XML_Util::getXMLDeclaration()
*/
public function testGetXMLDeclarationUsingVersionAndEncodingAndStandalone()
{
$version = "1.0";
$encoding = "UTF-8";
$standalone = true;
$expected = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>";
$this->assertEquals($expected, XML_Util::getXMLDeclaration($version, $encoding, $standalone));
}
/**
* @covers XML_Util::getXMLDeclaration()
*/
public function testGetXMLDeclarationUsingVersionAndStandalone()
{
$version = "1.0";
$encoding = null;
$standalone = true;
$expected = "<?xml version=\"1.0\" standalone=\"yes\"?>";
$this->assertEquals($expected, XML_Util::getXMLDeclaration($version, $encoding, $standalone));
}
}