diff --git a/core/modules/tracker/lib/Drupal/tracker/Tests/Views/TrackerTestBase.php b/core/modules/tracker/lib/Drupal/tracker/Tests/Views/TrackerTestBase.php index 28a7537..7aff628 100644 --- a/core/modules/tracker/lib/Drupal/tracker/Tests/Views/TrackerTestBase.php +++ b/core/modules/tracker/lib/Drupal/tracker/Tests/Views/TrackerTestBase.php @@ -40,11 +40,12 @@ protected function setUp() { 'status' => 1, )); - $this->comment = array( + $this->comment = entity_create('comment', array( + 'nid' => $this->node->id(), 'subject' => $this->randomName(), 'comment_body[' . LANGUAGE_NOT_SPECIFIED . '][0][value]' => $this->randomName(20), - ); - $this->drupalPost('comment/reply/' . $this->node->id(), $this->comment, t('Save')); + )); + } } diff --git a/core/modules/tracker/lib/Drupal/tracker/Tests/Views/TrackerUserUidTest.php b/core/modules/tracker/lib/Drupal/tracker/Tests/Views/TrackerUserUidTest.php index 46e73c9..c165a71 100644 --- a/core/modules/tracker/lib/Drupal/tracker/Tests/Views/TrackerUserUidTest.php +++ b/core/modules/tracker/lib/Drupal/tracker/Tests/Views/TrackerUserUidTest.php @@ -31,35 +31,47 @@ public static function getInfo() { * Tests the user uid filter and argument. */ public function testUserUid() { + $map = array( + 'nid' => 'nid', + 'node_title' => 'title', + ); + + $expected = array( + array( + 'nid' => $this->node->id(), + 'title' => $this->node->label(), + ) + ); + $view = views_get_view('test_tracker_user_uid'); $this->executeView($view); // We should have no results as the filter is set for uid 0. - $this->assertEqual(count($view->result), 0); + $this->assertIdenticalResultSet($view, array(), $map); + $view->destroy(); // Change the filter value to our user. - $view->destroy(); $view->initHandlers(); $view->filter['uid_touch_tracker']->value = $this->user->id(); $this->executeView($view); // We should have one result as the filter is set for the created user. - $this->assertEqual(count($view->result), 1); + $this->assertIdenticalResultSet($view, $expected, $map); + $view->destroy(); // Remove the filter now, so only the argument will affect the query. $view->removeItem('default', 'filter', 'uid_touch_tracker'); // Test the incorrect argument UID. - $view->destroy(); $view->initHandlers(); $this->executeView($view, array(rand())); - $this->assertEqual(count($view->result), 0); + $this->assertIdenticalResultSet($view, array(), $map); + $view->destroy(); // Test the correct argument UID. - $view->destroy(); $view->initHandlers(); $this->executeView($view, array($this->user->id())); - $this->assertEqual(count($view->result), 1); + $this->assertIdenticalResultSet($view, $expected, $map); } }