Tests the validation of display handlers.
public function testValidate() {
$view = views_get_view('test_executable_displays');
$view
->setDisplay('page_1');
$validate = $view
->validate();
// Validating a view shouldn't change the active display.
$this
->assertEqual('page_1', $view->current_display, "The display should be constant while validating");
$count = 0;
foreach ($view->displayHandlers as $id => $display) {
$match = function ($value) use ($display) {
return strpos($value, $display->display['display_title']) !== false;
};
$this
->assertTrue(array_filter($validate[$id], $match), format_string('Error message found for @id display', array(
'@id' => $id,
)));
$count++;
}
$this
->assertEqual(count($view->displayHandlers), $count, 'Error messages from all handlers merged.');
// Test that a deleted display is not included.
$display =& $view->storage
->getDisplay('default');
$display['deleted'] = TRUE;
$validate_deleted = $view
->validate();
$this
->assertNotIdentical($validate, $validate_deleted, 'Master display has not been validated.');
}