cvs: pecl(BRANCH_1_0_5) /sdo/tests/interop interop-xml.php
| From: | Simon Laws | Date: | Thu, 09 Nov 2006 13:15:37 +0000 |
| Subject: | cvs: pecl(BRANCH_1_0_5) /sdo/tests/interop interop-xml.php | ||
| Groups: | php.pecl.cvs | ||
| Request: | Send a blank email to pecl-cvs+get-6618@lists.php.net to get a copy of this message | ||
slaws Thu Nov 9 13:15:37 2006 UTC
Modified files: (Branch: BRANCH_1_0_5)
/pecl/sdo/tests/interop interop-xml.php
Log:
Tighten up testing of attribute equality
http://cvs.php.net/viewvc.cgi/pecl/sdo/tests/interop/interop-xml.php?r1=1.1&r2=1.1.4.1&diff_format=u
Index: pecl/sdo/tests/interop/interop-xml.php
diff -u pecl/sdo/tests/interop/interop-xml.php:1.1 pecl/sdo/tests/interop/interop-xml.php:1.1.4.1
--- pecl/sdo/tests/interop/interop-xml.php:1.1 Thu Sep 14 12:16:18 2006
+++ pecl/sdo/tests/interop/interop-xml.php Thu Nov 9 13:15:37 2006
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
| Author: SL |
+----------------------------------------------------------------------+
-$Id: interop-xml.php,v 1.1 2006/09/14 12:16:18 slaws Exp $
+$Id: interop-xml.php,v 1.1.4.1 2006/11/09 13:15:37 slaws Exp $
*/
/*
@@ -54,7 +54,7 @@
$message = $reason . " " . $nodename . ": Node1 count = $count1 Node2 count =
$count2";
if ( $count1 != $count2 ){
- throw new Exception ( $message );
+ throw new Exception ( $message );
}
if ( DEBUG == "on" ){
@@ -107,29 +107,59 @@
*/
function compareNodeAttributes ( $node1, $node2, $namespace )
{
- // attributes in the default namespace
$attributes1 = $node1->attributes($namespace);
$attributes2 = $node2->attributes($namespace);
-
- $reason = "ATTRIBUTE COUNT FOR NAMESPACE ";
-
- if ( $namespace == NULL ){
- $reason = $reason . "DEFAULT";
+
+ $count1 = count ($node1);
+ $count2 = count ($node2);
+
+ $message = "for node " . $node1->getName() . " in namespace " . $namespace
. " - ";
+
+ for ( $i = 0; $i < $count1; $i += 1 ) {
+ $att1 = $attributes1[$i];
+ $att1_type = gettype($att1);
+ $att1_name = null;
+ $att2 = $attributes2[$i];
+ $att2_type = gettype($att2);
+ $att2_name = null;
+
+ if ( $att1 != null && $att1_type != "NULL" ) {
+ $att1_name = $att1->getName();
+ }
+
+ if ( $att2 != null && $att2_type != "NULL" ) {
+ $att2_name = $att2->getName();
+ }
+
+ if ( $att1_type != $att2_type || $att1_name != $att2_name ) {
+ $message = $message . "Attribute $i not equal AttributeA = " . $att1_name .
" " . $att1 . " type " . $att1_type . " AttributeB = " . $att2_name .
" " . $att2 . " type " . $att2_type;
+
+ // test for a special case because we know schema location isn't copied to output
+ if ( $att1_name == "schemaLocation" || $att1_name ==
"noNamespaceSchemaLocation" ) {
+ //echo $message . "\n";
+ } else {
+ throw new Exception ( $message );
+ }
+ }
}
- else
- {
- $reason = $reason . $namespace;
+
+ if ( $count1 != $count2 ) {
+ $message = $message . "Attribute counts not equal count1 = " . $count1 . "
count2 = " . $count2;
+ throw new Exception ( $message );
}
-
- $attributecount = compareNodeCount ( $node1->getName(), $attributes1, $attributes2, $reason );
-
+
+ $attributecount = $count1;
+
if ( DEBUG == "on" && $attributecount > 0){
echo "ATTRIBUTES\n";
}
+ /*
for ( $i = 0; $i < $attributecount; $i += 1) {
compareXMLAttribute ( $attributes1[$i], $attributes2[$i] );
}
+ */
+
}
/*