php-src/ext/simplexml/tests/SimpleXMLElement_addAttribute_required_attribute_name.phpt
Máté Kocsis 6c8fb123d2
Promote warnings to exceptions in ext/simplexml
Closes GH-6011

Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>
2020-08-25 15:15:58 +02:00

23 lines
621 B
PHP

--TEST--
SimpleXMLElement: Test to ensure that the required attribute name correctly is giving a warning
--CREDITS--
Havard Eide <nucleuz@gmail.com>
#PHPTestFest2009 Norway 2009-06-09 \o/
--SKIPIF--
<?php if (!extension_loaded("simplexml")) { echo "skip extension not available"; } ?>
--FILE--
<?php
$a = new SimpleXMLElement("<php>testfest</php>");
try {
$a->addAttribute( "", "" );
} catch (ValueError $exception) {
echo $exception->getMessage() . "\n";
}
echo $a->asXML();
?>
--EXPECT--
SimpleXMLElement::addAttribute(): Argument #1 ($qualifiedName) cannot be empty
<?xml version="1.0"?>
<php>testfest</php>