From 4ed293f8a5a6d8902078dd7ebde8e95092923f50 Mon Sep 17 00:00:00 2001
From: Daniel Wehner <daniel.wehner@erdfisch.de>
Date: Mon, 27 Aug 2012 10:17:28 +0200
Subject: [PATCH] Add tests to save and load the view and see that the config
 stays the same.

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

diff --git a/lib/Drupal/views/Tests/ViewStorageTest.php b/lib/Drupal/views/Tests/ViewStorageTest.php
index 1f93e60554d3..fa07fbe1a863 100644
--- a/lib/Drupal/views/Tests/ViewStorageTest.php
+++ b/lib/Drupal/views/Tests/ViewStorageTest.php
@@ -158,6 +158,20 @@ function testConfigurableCRUD() {
     $config = config('views.view.archive_copy');
 
     $this->assertTrue($config->isNew(), 'Deleted config is now new.');
+
+    // Check whether load, save and load produce the same kind of view.
+    $values = config('views.view.archive')->get();
+    $created = $controller->create($values);
+
+    $created->save();
+    $loaded_entities = $controller->load(array($created->id()));
+    $created_loaded = reset($loaded_entities);
+    $values_loaded = config('views.view.archive')->get();
+
+    $this->assertTrue(isset($created_loaded->display['default']->display_options), 'Make sure that the display options exists.');
+    $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.');
   }
 
 }
-- 
GitLab