Commit 46aff5dd authored by tim.plunkett's avatar tim.plunkett

Issue #1778078 by tim.plunkett, dawehner: Call ViewExecutable::initDisplay()...

Issue #1778078 by tim.plunkett, dawehner: Call ViewExecutable::initDisplay() in ViewExecutable::initHandlers().
parent fc29f3cc
......@@ -70,7 +70,6 @@ public function testCommentWizard() {
$this->drupalPost(NULL, array(), t('Save'));
$view = views_get_view($view['name']);
$view->initDisplay();
$view->initHandlers();
$row = $view->display_handler->getOption('row');
$this->assertEqual($row['type'], 'comment');
......
......@@ -86,7 +86,6 @@ public function testUI() {
*/
public function testRenderArea() {
$view = views_get_view('test_example_area');
$view->initDisplay();
$view->initHandlers();
// Insert a random string to the test area plugin and see whether it is
......
......@@ -62,7 +62,6 @@ public function testRender() {
public function testQuery() {
// Tests adding additional fields to the query.
$view = $this->getBasicView();
$view->initDisplay();
$view->initHandlers();
$id_field = $view->field['id'];
......@@ -215,7 +214,6 @@ protected function xpathContent($content, $xpath, array $arguments = array()) {
*/
public function testAlterUrl() {
$view = $this->getBasicView();
$view->initDisplay();
$view->initHandlers();
$this->executeView($view);
$row = $view->result[0];
......@@ -364,7 +362,6 @@ public function testAlterUrl() {
*/
public function testRewrite() {
$view = $this->getBasicView();
$view->initDisplay();
$view->initHandlers();
$this->executeView($view);
$row = $view->result[0];
......@@ -385,7 +382,6 @@ public function testRewrite() {
*/
public function testFieldClasses() {
$view = views_get_view('test_field_classes');
$view->initDisplay();
$view->initHandlers();
// Tests whether the default field classes are added.
......@@ -531,7 +527,6 @@ public function testFieldTokens() {
*/
public function testExclude() {
$view = views_get_view('test_field_output');
$view->initDisplay();
$view->initHandlers();
// Hide the field and see whether it's rendered.
$view->field['name']->options['exclude'] = TRUE;
......@@ -555,7 +550,6 @@ public function testExclude() {
*/
public function testTextRendering() {
$view = views_get_view('test_field_output');
$view->initDisplay();
$view->initHandlers();
$name_field = $view->field['name'];
......@@ -958,7 +952,6 @@ function _testEmptyText() {
*/
function testIsValueEmpty() {
$view = $this->getView();
$view->initDisplay();
$view->initHandlers();
$field = $view->field['name'];
......
......@@ -120,7 +120,6 @@ public function testRelationshipQuery() {
),
));
$view->initDisplay();
$view->initHandlers();
// Check for all beatles created by admin.
......@@ -137,7 +136,6 @@ public function testRelationshipQuery() {
$view->destroy();
// Check for all beatles created by another user, which so doesn't exist.
$view->initDisplay();
$view->initHandlers();
$view->filter['uid']->value = array(3);
$this->executeView($view);
......@@ -147,7 +145,6 @@ public function testRelationshipQuery() {
// Set the relationship to required, so only results authored by the admin
// should return.
$view->initDisplay();
$view->initHandlers();
$view->relationship['uid']->options['required'] = TRUE;
$this->executeView($view);
......@@ -162,7 +159,6 @@ public function testRelationshipQuery() {
$view->destroy();
// Set the relationship to optional should cause to return all beatles.
$view->initDisplay();
$view->initHandlers();
$view->relationship['uid']->options['required'] = FALSE;
$this->executeView($view);
......
......@@ -47,7 +47,6 @@ public function testFilter() {
$node = $this->drupalCreateNode(array('uid' => $no_author->id()));
$view = views_get_view('test_filter_node_uid_revision');
$view->initDisplay();
$view->initHandlers();
$view->filter['uid_revision']->value = array($author->uid);
......
......@@ -59,6 +59,35 @@ public static function getInfo() {
);
}
/**
* Tests the initDisplay() and initHandlers() methods.
*/
public function testInitMethods() {
$view = $this->getBasicView();
$view->initDisplay();
$this->assertTrue($view->display_handler instanceof DefaultDisplay, 'Make sure a reference to the current display handler is set.');
$this->assertTrue($view->displayHandlers['default'] instanceof DefaultDisplay, 'Make sure a display handler is created for each display.');
$view = $this->getBasicView();
$view->destroy();
$view->initHandlers();
// Check for all handler types.
$handler_types = array_keys(ViewExecutable::viewsHandlerTypes());
foreach ($handler_types as $type) {
// The views_test integration doesn't have relationships.
if ($type == 'relationship') {
continue;
}
$this->assertTrue(count($view->$type), format_string('Make sure a %type instance got instantiated.', array('%type' => $type)));
}
// initHandlers() should create display handlers automatically as well.
$this->assertTrue($view->display_handler instanceof DefaultDisplay, 'Make sure a reference to the current display handler is set.');
$this->assertTrue($view->displayHandlers['default'] instanceof DefaultDisplay, 'Make sure a display handler is created for each display.');
}
/**
* Overrides Drupal\views\Tests\ViewTestBase::getBasicView().
*/
......
......@@ -702,6 +702,7 @@ public function initStyle() {
* Acquire and attach all of the handlers.
*/
public function initHandlers() {
$this->initDisplay();
if (empty($this->inited)) {
foreach ($this::viewsHandlerTypes() as $key => $info) {
$this->_initHandler($key, $info);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment