X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Ftracker%2Ftests%2Fsrc%2FFunctional%2FViews%2FTrackerUserUidTest.php;fp=web%2Fcore%2Fmodules%2Ftracker%2Ftests%2Fsrc%2FFunctional%2FViews%2FTrackerUserUidTest.php;h=7bd675b2ed1d301e3afb828410d253703d9e9bcc;hp=0000000000000000000000000000000000000000;hb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;hpb=aea91e65e895364e460983b890e295aa5d5540a5 diff --git a/web/core/modules/tracker/tests/src/Functional/Views/TrackerUserUidTest.php b/web/core/modules/tracker/tests/src/Functional/Views/TrackerUserUidTest.php new file mode 100644 index 000000000..7bd675b2e --- /dev/null +++ b/web/core/modules/tracker/tests/src/Functional/Views/TrackerUserUidTest.php @@ -0,0 +1,68 @@ + 'nid', + 'title' => 'title', + ]; + + $expected = [ + [ + 'nid' => $this->node->id(), + 'title' => $this->node->label(), + ] + ]; + + $view = Views::getView('test_tracker_user_uid'); + $this->executeView($view); + + // We should have no results as the filter is set for uid 0. + $this->assertIdenticalResultSet($view, [], $map); + $view->destroy(); + + // Change the filter value to our user. + $view->initHandlers(); + $view->filter['uid_touch_tracker']->value = $this->node->getOwnerId(); + $this->executeView($view); + + // We should have one result as the filter is set for the created user. + $this->assertIdenticalResultSet($view, $expected, $map); + $view->destroy(); + + // Remove the filter now, so only the argument will affect the query. + $view->removeHandler('default', 'filter', 'uid_touch_tracker'); + + // Test the incorrect argument UID. + $view->initHandlers(); + $this->executeView($view, [rand()]); + $this->assertIdenticalResultSet($view, [], $map); + $view->destroy(); + + // Test the correct argument UID. + $view->initHandlers(); + $this->executeView($view, [$this->node->getOwnerId()]); + $this->assertIdenticalResultSet($view, $expected, $map); + } + +}