3 namespace Drupal\Tests\views\Unit\Plugin\area;
5 use Drupal\Tests\UnitTestCase;
6 use Drupal\views\Plugin\views\area\Messages;
9 * @coversDefaultClass \Drupal\views\Plugin\views\area\Messages
12 class MessagesTest extends UnitTestCase {
15 * The view executable object.
17 * @var \Drupal\views\ViewExecutable
22 * The message handler.
24 * @var \Drupal\views\Plugin\views\area\Messages
26 protected $messagesHandler;
31 protected function setUp() {
34 $this->messagesHandler = new Messages([], 'result', []);
38 * Tests the render method.
40 * @covers ::defineOptions
43 public function testRender() {
44 // The handler is configured to show with empty views by default, so should
46 $this->assertSame(['#type' => 'status_messages'], $this->messagesHandler->render());
48 // Turn empty off, and make sure it isn't rendered.
49 $this->messagesHandler->options['empty'] = FALSE;
50 // $empty parameter passed to render will still be FALSE, so should still
52 $this->assertSame(['#type' => 'status_messages'], $this->messagesHandler->render());
53 // Should now be empty as both the empty option and parameter are empty.
54 $this->assertSame([], $this->messagesHandler->render(TRUE));