diff --git a/core/modules/views/src/ViewExecutable.php b/core/modules/views/src/ViewExecutable.php index f13c0e7..a4d653a 100644 --- a/core/modules/views/src/ViewExecutable.php +++ b/core/modules/views/src/ViewExecutable.php @@ -2,6 +2,7 @@ namespace Drupal\views; +use Drupal\Component\Render\FormattableMarkup; use Drupal\Component\Utility\Html; use Drupal\Component\Utility\Tags; use Drupal\Core\Routing\RouteProviderInterface; @@ -799,7 +800,7 @@ public function setDisplay($display_id = NULL) { // Ensure the requested display exists. if (!$this->displayHandlers->has($display_id)) { - debug(format_string('setDisplay() called with invalid display ID "@display".', ['@display' => $display_id])); + trigger_error(new FormattableMarkup('setDisplay() called with invalid display ID "@display".', ['@display' => $display_id])); return FALSE; } diff --git a/core/modules/views/tests/src/Kernel/ViewExecutableTest.php b/core/modules/views/tests/src/Kernel/ViewExecutableTest.php index 6ef104c..344d8a3 100644 --- a/core/modules/views/tests/src/Kernel/ViewExecutableTest.php +++ b/core/modules/views/tests/src/Kernel/ViewExecutableTest.php @@ -196,11 +196,8 @@ public function testSetDisplayWithInvalidDisplay() { $view->initDisplay(); // Error is triggered while calling the wrong display. - $this->setExpectedException(\PHPUnit_Framework_Error::class); + $this->setExpectedException(\PHPUnit_Framework_Error::class, 'setDisplay() called with invalid display ID "invalid".'); $view->setDisplay('invalid'); - - $this->assertEqual($view->current_display, 'default', 'If setDisplay is called with an invalid display id the default display should be used.'); - $this->assertEqual(spl_object_hash($view->display_handler), spl_object_hash($view->displayHandlers->get('default'))); } /**