From 0fcf20f6dc406831640bc85a9bc209fae08ea80e Mon Sep 17 00:00:00 2001
From: Tim Plunkett <git@plnktt.com>
Date: Sun, 26 Aug 2012 15:55:48 +0200
Subject: [PATCH] Issue #1757154 by tim.plunkett: Add a base test class for
 tests that need views_test.module.

---
 .../views/Tests/ViewsSchemaTestBase.php       | 36 +++++++++++++++++++
 lib/Drupal/views/Tests/ViewsSqlTest.php       | 17 ---------
 2 files changed, 36 insertions(+), 17 deletions(-)
 create mode 100644 lib/Drupal/views/Tests/ViewsSchemaTestBase.php

diff --git a/lib/Drupal/views/Tests/ViewsSchemaTestBase.php b/lib/Drupal/views/Tests/ViewsSchemaTestBase.php
new file mode 100644
index 000000000000..fc9aac85a329
--- /dev/null
+++ b/lib/Drupal/views/Tests/ViewsSchemaTestBase.php
@@ -0,0 +1,36 @@
+<?php
+
+/**
+ * @file
+ * Definition of Drupal\views\Tests\ViewsSchemaTestBase.
+ */
+
+namespace Drupal\views\Tests;
+
+/**
+ * Provides access to the test module schema and Views data.
+ */
+abstract class ViewsSchemaTestBase extends ViewsSqlTest {
+
+  protected function setUp() {
+    parent::setUp();
+
+    // Define the schema and views data variable before enabling the test module.
+    variable_set('views_test_schema', $this->schemaDefinition());
+    variable_set('views_test_views_data', $this->viewsData());
+
+    module_enable(array('views_test'));
+    $this->resetAll();
+
+    // Load the test dataset.
+    $data_set = $this->dataSet();
+    $query = db_insert('views_test')
+      ->fields(array_keys($data_set[0]));
+    foreach ($data_set as $record) {
+      $query->values($record);
+    }
+    $query->execute();
+    $this->checkPermissions(array(), TRUE);
+  }
+
+}
diff --git a/lib/Drupal/views/Tests/ViewsSqlTest.php b/lib/Drupal/views/Tests/ViewsSqlTest.php
index ed86e2328aec..25864464504e 100644
--- a/lib/Drupal/views/Tests/ViewsSqlTest.php
+++ b/lib/Drupal/views/Tests/ViewsSqlTest.php
@@ -28,23 +28,6 @@ protected function setUp() {
     views_module_include('views_default', TRUE);
     views_get_all_views(TRUE);
     menu_router_rebuild();
-
-    // Define the schema and views data variable before enabling the test module.
-    variable_set('views_test_schema', $this->schemaDefinition());
-    variable_set('views_test_views_data', $this->viewsData());
-
-    module_enable(array('views_test'));
-    $this->resetAll();
-
-    // Load the test dataset.
-    $data_set = $this->dataSet();
-    $query = db_insert('views_test')
-      ->fields(array_keys($data_set[0]));
-    foreach ($data_set as $record) {
-      $query->values($record);
-    }
-    $query->execute();
-    $this->checkPermissions(array(), TRUE);
   }
 
   /**
-- 
GitLab