From 5ee195f5f31f97f4136f2aaa1db345e98da88c74 Mon Sep 17 00:00:00 2001
From: damiankloip <damian@damoweb.co.uk>
Date: Mon, 27 Aug 2012 12:25:55 +0200
Subject: [PATCH] Add a test to check creation and saving of a new display

---
 lib/Drupal/views/Tests/ViewStorageTest.php | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/lib/Drupal/views/Tests/ViewStorageTest.php b/lib/Drupal/views/Tests/ViewStorageTest.php
index 5dc7ec07f0c3..33bada2ac15c 100644
--- a/lib/Drupal/views/Tests/ViewStorageTest.php
+++ b/lib/Drupal/views/Tests/ViewStorageTest.php
@@ -172,6 +172,19 @@ function testConfigurableCRUD() {
     $this->assertEqual($created_loaded->display['default']->display_plugin, 'default', 'Make sure the right display plugin is set.');
 
     $this->assertEqual($values, $values_loaded, 'The loaded config is the same as the original loaded one.');
+
+    // Check whether a display can be added and saved to a View.
+    $created = $controller->create($values);
+    $created->new_display('page', 'Test', 'test');
+
+    $new_display = $created->display['test'];
+    $this->assertTrue($new_display instanceof ViewDisplay, 'New page display "test" created.');
+
+    $created->set('name', 'archive_new_display');
+    $created->save();
+    $values = config('views.view.archive_new_display')->get();
+
+    $this->assertTrue(isset($values['display']['test']) && is_array($values['display']['test']), 'New display was saved.');
   }
 
 }
-- 
GitLab