--- /dev/null
+--TEST--
+DomDocument::createAttribute() - basic test for DomDocument::createAttribute()
+--CREDITS--
+Muhammad Khalid Adnan
+# TestFest 2008
+--FILE--
+<?php
+
+$doc = new DOMDocument;
+
+$node = $doc->createElement("para");
+$newnode = $doc->appendChild($node);
+
+// A pass case.
+$test_attribute = $doc->createAttribute("hahaha");
+$node->appendChild($test_attribute);
+
+echo $doc->saveXML();
+
+?>
+--EXPECT--
+<?xml version="1.0"?>
+<para hahaha=""/>
+
--- /dev/null
+--TEST--
+Test DOMDocument::createAttribute() for expected expection thrown when wrong parameter passed
+--FILE--
+<?php
+$dom = new DOMDocument();
+
+try {
+ $attr = $dom->createAttribute(0);
+}
+catch(DOMException $e) {
+ $code = $e->getCode();
+ if(DOM_INVALID_CHARACTER_ERR === $code) {
+ echo "PASS";
+ }
+ else {
+ echo 'Wrong exception code';
+ }
+}
+catch(Exception $e) {
+ echo 'Wrong exception thrown';
+}
+
+?>
+--EXPECTF--
+PASS
--- /dev/null
+--TEST--
+DomDocument::createAttribute() - error test for DomDocument::createAttribute()
+--CREDITS--
+Muhammad Khalid Adnan
+# TestFest 2008
+--FILE--
+<?php
+
+$doc = new DOMDocument;
+
+$node = $doc->createElement("para");
+$newnode = $doc->appendChild($node);
+
+try {
+ $failed_test_attribute = $doc->createAttribute("ha haha");
+ $node->appendChild($failed_test_attribute);
+
+ echo $doc->saveXML();
+}
+catch (DOMException $e) {
+ echo 'Test failed!', PHP_EOL;
+}
+
+?>
+--EXPECT--
+Test failed!
+
--- /dev/null
+--TEST--
+Test DOMDocument::createAttribute() for expected return value
+--FILE--
+<?php
+$dom = new DOMDocument();
+
+$attr = $dom->createAttribute('string');
+echo get_class($attr);
+
+?>
+--EXPECTF--
+DOMAttr