/** * Sets up the testing view with random field data. * * @param \Drupal\views\ViewExecutable $view * The view to add field data to. */ protected function prepareView(ViewExecutable $view) { $view->initDisplay(); foreach ($this->fieldStorages as $field_storage) { $field_name = $field_storage->getName(); $view->display_handler->options['fields'][$field_name]['id'] = $field_name; $view->display_handler->options['fields'][$field_name]['table'] = 'node__' . $field_name; $view->display_handler->options['fields'][$field_name]['field'] = $field_name; } }
/** * Changes the tid filter to given term and depth. * * @param integer $tid * The term ID to filter on. * @param integer $depth * The depth to search. * @param array $expected * The expected views result. */ protected function assertTermWithDepthResult($tid, $depth, array $expected) { $this->view->destroy(); $this->view->initDisplay(); $filters = $this->view->displayHandlers->get('default')->getOption('filters'); $filters['tid_depth']['depth'] = $depth; $filters['tid_depth']['value'] = [$tid]; $this->view->displayHandlers->get('default')->setOption('filters', $filters); $this->executeView($this->view); $this->assertIdenticalResultsetHelper($this->view, $expected, ['nid' => 'nid'], 'assertIdentical'); }
/** * Analyzes a review and return the results. * * @param \Drupal\views\ViewExecutable $view * The view to analyze. * * @return array * An array of analyze results organized into arrays keyed by 'ok', * 'warning' and 'error'. */ public function getMessages(ViewExecutable $view) { $view->initDisplay(); $messages = $this->moduleHandler->invokeAll('views_analyze', array($view)); return $messages; }