diff --git a/core/modules/views/tests/Drupal/views/Tests/Plugin/area/MessagesTest.php b/core/modules/views/tests/Drupal/views/Tests/Plugin/area/MessagesTest.php new file mode 100644 index 0000000..a94026e --- /dev/null +++ b/core/modules/views/tests/Drupal/views/Tests/Plugin/area/MessagesTest.php @@ -0,0 +1,77 @@ + 'Area: Messages', + 'description' => 'Tests the Drupal\views\Plugin\views\area\Messages handler.', + 'group' => 'Views Handlers', + ); + } + + /** + * {@inheritdoc} + */ + public function setUp() { + parent::setUp(); + + $this->messagesHandler = new Messages(array(), 'result', array()); + } + + /** + * Tests the render method. + * + * @covers ::render() + */ + public function testRender() { + // The handler is configured to show with empty views by default, so should + // appear. + $this->assertSame(array('#theme' => 'status_messages'), $this->messagesHandler->render()); + + // Turn empty off, and make sure it isn't rendered. + $this->messagesHandler->options['empty'] = FALSE; + // $empty parameter passed to render will still be FALSE, so should still + // appear. + $this->assertsame(array('#theme' => 'status_messages'), $this->messagesHandler->render()); + // Should now be empty as both the empty option and parameter are empty. + $this->assertSame(array(), $this->messagesHandler->render(TRUE)); + + } + +}