commit 20404fb1fcbc59d753ee3e0b9f1a20b53bf1cab2 Author: Joel Pittet Date: Sat Feb 8 21:38:03 2014 -0800 reference passing and xpath fixes. diff --git a/core/modules/system/lib/Drupal/system/Tests/Theme/TableTest.php b/core/modules/system/lib/Drupal/system/Tests/Theme/TableTest.php index 30c5952..4d7efc8 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Theme/TableTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Theme/TableTest.php @@ -27,7 +27,8 @@ public static function getInfo() { function testThemeTableStickyHeaders() { $header = array('one', 'two', 'three'); $rows = array(array(1,2,3), array(4,5,6), array(7,8,9)); - $this->content = drupal_render(array('#theme' => 'table', '#header' => $header, '#rows' => $rows, '#sticky' => TRUE)); + $table = array('#theme' => 'table', '#header' => $header, '#rows' => $rows, '#sticky' => TRUE); + $this->content = drupal_render($table); $js = _drupal_add_js(); $this->assertTrue(isset($js['core/misc/tableheader.js']), 'tableheader.js was included when $sticky = TRUE.'); $this->assertRaw('sticky-enabled', 'Table has a class of sticky-enabled when $sticky = TRUE.'); @@ -43,7 +44,8 @@ function testThemeTableNoStickyHeaders() { $attributes = array(); $caption = NULL; $colgroups = array(); - $this->content = drupal_render(array('#theme' => 'table', '#header' => $header, '#rows' => $rows, '#attributes' => $attributes, '#caption' => $caption, '#colgroups' => $colgroups, '#sticky' => FALSE)); + $table = array('#theme' => 'table', '#header' => $header, '#rows' => $rows, '#attributes' => $attributes, '#caption' => $caption, '#colgroups' => $colgroups, '#sticky' => FALSE); + $this->content = drupal_render($table); $js = _drupal_add_js(); $this->assertFalse(isset($js['core/misc/tableheader.js']), 'tableheader.js was not included because $sticky = FALSE.'); $this->assertNoRaw('sticky-enabled', 'Table does not have a class of sticky-enabled because $sticky = FALSE.'); @@ -62,9 +64,10 @@ function testThemeTableWithEmptyMessage() { 'colspan' => 2, ), ); - $this->content = drupal_render(array('#theme' => 'table', '#header' => $header, '#rows' => array(), '#empty' => t('No strings available.'))); - $this->assertTrue($this->xpath('//tr[@class="odd"]/td[@colspan="3" and @class="empty message"]'), 'Correct colspan was set on empty message.'); - $this->assertTrue($this->xpath('//thead/tr/th'), 'Table header was printed.'); + $table = array('#theme' => 'table', '#header' => $header, '#rows' => array(), '#empty' => t('No strings available.')); + $this->content = drupal_render($table); + $this->assertTrue($this->xpath('//tr[@class="odd"]/td[@colspan="3" and @class="empty message" and text()=:text]', array(':text' => t('No strings available.'))), 'Correct colspan was set on empty message.'); + $this->assertTrue($this->xpath('//thead/tr/th[text()=:text]', array(':text' => t('Header 1'))), 'Table header was printed.'); } /** @@ -77,7 +80,8 @@ function testThemeTableWithNoStriping() { 'no_striping' => TRUE, ), ); - $this->content = drupal_render(array('#theme' => 'table', '#rows' => $rows)); + $table = array('#theme' => 'table', '#rows' => $rows); + $this->content = drupal_render($table); $this->assertNoRaw('class="odd"', 'Odd/even classes were not added because $no_striping = TRUE.'); $this->assertNoRaw('no_striping', 'No invalid no_striping HTML attribute was printed.'); } @@ -93,8 +97,8 @@ function testThemeTableHeaderCellOption() { array('data' => 1), ), ); - - $this->content = drupal_render(array('#theme' => 'table', '#rows' => $rows)); + $table = array('#theme' => 'table', '#rows' => $rows); + $this->content = drupal_render($table); $this->assertRaw('111', 'The th and td tags was printed correctly.'); } }