TrackerUserUidTest.php in Zircon Profile 8.0
File
core/modules/tracker/src/Tests/Views/TrackerUserUidTest.php
View source
<?php
namespace Drupal\tracker\Tests\Views;
use Drupal\views\Views;
class TrackerUserUidTest extends TrackerTestBase {
public static $testViews = array(
'test_tracker_user_uid',
);
public function testUserUid() {
$map = array(
'nid' => 'nid',
'title' => 'title',
);
$expected = array(
array(
'nid' => $this->node
->id(),
'title' => $this->node
->label(),
),
);
$view = Views::getView('test_tracker_user_uid');
$this
->executeView($view);
$this
->assertIdenticalResultSet($view, array(), $map);
$view
->destroy();
$view
->initHandlers();
$view->filter['uid_touch_tracker']->value = $this->node
->getOwnerId();
$this
->executeView($view);
$this
->assertIdenticalResultSet($view, $expected, $map);
$view
->destroy();
$view
->removeHandler('default', 'filter', 'uid_touch_tracker');
$view
->initHandlers();
$this
->executeView($view, array(
rand(),
));
$this
->assertIdenticalResultSet($view, array(), $map);
$view
->destroy();
$view
->initHandlers();
$this
->executeView($view, array(
$this->node
->getOwnerId(),
));
$this
->assertIdenticalResultSet($view, $expected, $map);
}
}