commit d2d5d30e74d087e894880088c9ea0ed2039a019f Author: Joel Pittet Date: Thu Aug 14 21:42:57 2014 -0700 fix locale attribute order tests diff --git a/core/modules/locale/src/Tests/LocaleContentTest.php b/core/modules/locale/src/Tests/LocaleContentTest.php index 3ec3c71..5229eb7 100644 --- a/core/modules/locale/src/Tests/LocaleContentTest.php +++ b/core/modules/locale/src/Tests/LocaleContentTest.php @@ -177,26 +177,26 @@ public function testContentTypeDirLang() { // Check if English node does not have lang tag. $this->drupalGet('node/' . $nodes['en']->id()); - $pattern = '|class="[^"]*node[^"]*"[^<>]*lang="en"|'; - $this->assertNoPattern($pattern, 'The lang tag has not been assigned to the English node.'); + $element = $this->xpath('//article[@class and contains(concat(" ", normalize-space(@class), " "), " node ") and @lang="en"]'); + $this->assertTrue(empty($element), 'The lang tag has not been assigned to the English node.'); // Check if English node does not have dir tag. - $pattern = '|class="[^"]*node[^"]*"[^<>]*dir="ltr"|'; - $this->assertNoPattern($pattern, 'The dir tag has not been assigned to the English node.'); + $element = $this->xpath('//article[@class and contains(concat(" ", normalize-space(@class), " "), " node ") and @dir="ltr"]'); + $this->assertTrue(empty($element), 'The dir tag has not been assigned to the English node.'); // Check if Arabic node has lang="ar" & dir="rtl" tags. $this->drupalGet('node/' . $nodes['ar']->id()); - $pattern = '|class="[^"]*node[^"]*"[^<>]*lang="ar" dir="rtl"|'; - $this->assertPattern($pattern, 'The lang and dir tags have been assigned correctly to the Arabic node.'); + $element = $this->xpath('//article[@class and contains(concat(" ", normalize-space(@class), " "), " node ") and @lang="ar" and @dir="rtl"]'); + $this->assertTrue(!empty($element), 'The lang and dir tags have been assigned correctly to the Arabic node.'); // Check if Spanish node has lang="es" tag. $this->drupalGet('node/' . $nodes['es']->id()); - $pattern = '|class="[^"]*node[^"]*"[^<>]*lang="es"|'; - $this->assertPattern($pattern, 'The lang tag has been assigned correctly to the Spanish node.'); + $element = $this->xpath('//article[@class and contains(concat(" ", normalize-space(@class), " "), " node ") and @lang="es"]'); + $this->assertTrue(!empty($element), 'The lang tag has been assigned correctly to the Spanish node.'); // Check if Spanish node does not have dir="ltr" tag. - $pattern = '|class="[^"]*node[^"]*"[^<>]*lang="es" dir="ltr"|'; - $this->assertNoPattern($pattern, 'The dir tag has not been assigned to the Spanish node.'); + $element = $this->xpath('//article[@class and contains(concat(" ", normalize-space(@class), " "), " node ") and @lang="es" and @dir="ltr"]'); + $this->assertTrue(empty($element), 'The dir tag has not been assigned to the Spanish node.'); } }