@@ -54,6 +54,11 @@ private function buildPath(DOMNode $n)
5454 return "/ $ ret " ;
5555 }
5656
57+ private function isDate ($ date )
58+ {
59+ return preg_match ('/^\d{4}-\d{2}-\d{2}/ ' , $ date );
60+ }
61+
5762 /**
5863 * compare two system view documents.
5964 *
@@ -81,7 +86,11 @@ private function assertEquivalentSystem(DOMElement $expected, DOMElement $output
8186 $ o = $ output ->childNodes ->item ($ index );
8287 $ this ->assertInstanceOf ('DOMElement ' , $ o , "No child element at $ index in " .$ this ->buildPath ($ child ));
8388 $ this ->assertEquals ('sv:value ' , $ o ->tagName , 'Unexpected tag name at ' .$ this ->buildPath ($ expected )."sv:value[ $ index] " );
84- $ this ->assertEquals ($ child ->textContent , $ o ->textContent , 'Not the same text at ' .$ this ->buildPath ($ output )."sv:value[ $ index] " );
89+ if ($ this ->isDate ($ child ->textContent ) && $ this ->isDate ($ o ->textContent )) {
90+ $ this ->assertEqualDateString ($ child ->textContent , $ o ->textContent , 'Not the same date at ' .$ this ->buildPath ($ output )."sv:value[ $ index] " );
91+ } else {
92+ $ this ->assertEquals ($ child ->textContent , $ o ->textContent , 'Not the same text at ' .$ this ->buildPath ($ output )."sv:value[ $ index] " );
93+ }
8594 }
8695 }
8796 } elseif ($ expected ->tagName == 'sv:node ' ) {
@@ -130,7 +139,11 @@ private function assertEquivalentDocument(DOMElement $expected, DOMElement $outp
130139 } else {
131140 $ oattr = $ output ->attributes ->getNamedItem ($ attr ->name );
132141 $ this ->assertNotNull ($ oattr , 'missing attribute ' .$ attr ->name .' at ' .$ this ->buildPath ($ expected ));
133- $ this ->assertEquals ($ attr ->value , $ oattr ->value , 'wrong attribute value at ' .$ this ->buildPath ($ expected ).'/ ' .$ attr ->name );
142+ if ($ this ->isDate ($ attr ->value ) && $ this ->isDate ($ oattr ->value )) {
143+ $ this ->assertEqualDateString ($ attr ->value , $ oattr ->value , 'wrong attribute value at ' .$ this ->buildPath ($ expected ).'/ ' .$ attr ->name );
144+ } else {
145+ $ this ->assertEquals ($ attr ->value , $ oattr ->value , 'wrong attribute value at ' .$ this ->buildPath ($ expected ).'/ ' .$ attr ->name );
146+ }
134147 }
135148 }
136149
0 commit comments