]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-19840 Fixed detection of empty attributes
authornicolasconnault <nicolasconnault>
Wed, 29 Jul 2009 01:23:47 +0000 (01:23 +0000)
committernicolasconnault <nicolasconnault>
Wed, 29 Jul 2009 01:23:47 +0000 (01:23 +0000)
lib/simpletest/testoutputlib.php
lib/simpletestlib.php

index 5c1ecb3cc053a98954ac4718d2a007aaf8f3be7b..d41b0a4f3c1b74b8f86bc82978269f33434e0ad0 100644 (file)
@@ -998,7 +998,7 @@ class moodle_core_renderer_test extends UnitTestCase {
         // Add a few classes to the link object
         $link->add_classes('cool blue');
         $html = $this->renderer->link($link);
-        $this->assert(new ContainsTagWithAttributes('a', array('title' => 'Link to resource 1', 'class' => 'link cool blue', 'href' => 'http://test.com')), $html);
+        $this->assert(new ContainsTagWithAttributes('a', array('title' => 'Link to resource 1', 'class' => 'cool blue', 'href' => 'http://test.com')), $html);
         $this->assert(new ContainsTagWithContents('a', 'Resource 1'), $html);
 
         // Simple use of link() without a html_link object
index ae085d00fc5c6cfbd9e623220aba5056ebf72f7b..14b87749815c7b97c15f8613d07c3ad334b7ec67 100644 (file)
@@ -277,7 +277,7 @@ class ContainsTagWithAttributes extends SimpleExpectation {
             $allattributesmatch = true;
 
             foreach ($this->expectedvalues as $expectedattribute => $expectedvalue) {
-                if (!$node->getAttribute($expectedattribute)) {
+                if (!$node->getAttribute($expectedattribute) && $expectedvalue != '') {
                     $this->failurereason = 'nomatch';
                     continue 2; // Skip this tag, it doesn't have all the expected attributes
                 }