From 4c53f626bd13e9863c0a79a665829b882e23aa08 Mon Sep 17 00:00:00 2001 From: nicolasconnault Date: Wed, 29 Jul 2009 01:23:47 +0000 Subject: [PATCH] MDL-19840 Fixed detection of empty attributes --- lib/simpletest/testoutputlib.php | 2 +- lib/simpletestlib.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/simpletest/testoutputlib.php b/lib/simpletest/testoutputlib.php index 5c1ecb3cc0..d41b0a4f3c 100644 --- a/lib/simpletest/testoutputlib.php +++ b/lib/simpletest/testoutputlib.php @@ -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 diff --git a/lib/simpletestlib.php b/lib/simpletestlib.php index ae085d00fc..14b8774981 100644 --- a/lib/simpletestlib.php +++ b/lib/simpletestlib.php @@ -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 } -- 2.39.5