From 3865a7c8d4b947dcae549a8f5282dd805dfb80c7 Mon Sep 17 00:00:00 2001 From: damiankloip <damiankloip@1037976.no-reply.drupal.org> Date: Sat, 11 Aug 2012 22:43:10 -0400 Subject: [PATCH] Issue #1711640 by damiankloip, tim.plunkett, aspilicious: Use $modules property for enabling tests. --- lib/Drupal/views/Tests/AnalyzeTest.php | 3 ++- lib/Drupal/views/Tests/ArgumentDefaultTest.php | 5 +++-- lib/Drupal/views/Tests/ExposedFormTest.php | 5 +++-- lib/Drupal/views/Tests/GlossaryTest.php | 5 +---- lib/Drupal/views/Tests/HandlersTest.php | 6 +----- lib/Drupal/views/Tests/PagerTest.php | 5 +---- lib/Drupal/views/Tests/UiGroupByTest.php | 11 +++++++++-- lib/Drupal/views/Tests/UiSettingsTest.php | 10 +++++++++- lib/Drupal/views/Tests/UpgradeTestCase.php | 14 +++++++++++--- .../views/Tests/User/UserArgumentValidate.php | 4 +++- lib/Drupal/views/Tests/ViewsSqlTest.php | 9 ++++++++- lib/Drupal/views/Tests/ViewsTestBase.php | 8 ++++++++ lib/Drupal/views/Tests/WizardTestBase.php | 4 ++-- 13 files changed, 61 insertions(+), 28 deletions(-) diff --git a/lib/Drupal/views/Tests/AnalyzeTest.php b/lib/Drupal/views/Tests/AnalyzeTest.php index b86edbc166a1..79763eb27b46 100644 --- a/lib/Drupal/views/Tests/AnalyzeTest.php +++ b/lib/Drupal/views/Tests/AnalyzeTest.php @@ -11,6 +11,7 @@ * Tests the views analyze system. */ class AnalyzeTest extends ViewsSqlTest { + public static function getInfo() { return array( 'name' => 'Views Analyze', @@ -20,7 +21,7 @@ public static function getInfo() { } public function setUp() { - parent::setUp('views_ui'); + parent::setUp(); // Add an admin user will full rights; $this->admin = $this->drupalCreateUser(array('administer views')); diff --git a/lib/Drupal/views/Tests/ArgumentDefaultTest.php b/lib/Drupal/views/Tests/ArgumentDefaultTest.php index 7d49d232d40b..0cdf880e560a 100644 --- a/lib/Drupal/views/Tests/ArgumentDefaultTest.php +++ b/lib/Drupal/views/Tests/ArgumentDefaultTest.php @@ -13,6 +13,7 @@ * Basic test for pluggable argument default. */ class ArgumentDefaultTest extends ViewsSqlTest { + public static function getInfo() { return array( 'name' => 'Argument default', @@ -22,7 +23,7 @@ public static function getInfo() { } public function setUp() { - parent::setUp('views'); + parent::setUp(); $this->random = $this->randomString(); } @@ -31,7 +32,7 @@ public function setUp() { * Tests the use of a default argument plugin that provides no options. */ function testArgumentDefaultNoOptions() { - module_enable(array('views_ui', 'views_test')); + module_enable(array('views_test')); $admin_user = $this->drupalCreateUser(array('administer views', 'administer site configuration')); $this->drupalLogin($admin_user); diff --git a/lib/Drupal/views/Tests/ExposedFormTest.php b/lib/Drupal/views/Tests/ExposedFormTest.php index 3546da25a28d..976af0b678e3 100644 --- a/lib/Drupal/views/Tests/ExposedFormTest.php +++ b/lib/Drupal/views/Tests/ExposedFormTest.php @@ -11,6 +11,7 @@ * Tests exposed forms. */ class ExposedFormTest extends ViewsSqlTest { + public static function getInfo() { return array( 'name' => 'Exposed forms', @@ -20,8 +21,8 @@ public static function getInfo() { } public function setUp() { - parent::setUp('views_ui'); - module_enable(array('views_ui')); + parent::setUp(); + // @TODO Figure out why it's required to clear the cache here. views_module_include('views_default', TRUE); views_get_all_views(TRUE); diff --git a/lib/Drupal/views/Tests/GlossaryTest.php b/lib/Drupal/views/Tests/GlossaryTest.php index b915d8388f2d..35d2e710b63d 100644 --- a/lib/Drupal/views/Tests/GlossaryTest.php +++ b/lib/Drupal/views/Tests/GlossaryTest.php @@ -11,6 +11,7 @@ * Tests glossary view ( summary of arguments ). */ class GlossaryTest extends ViewsSqlTest { + public static function getInfo() { return array( 'name' => 'Glossary Test', @@ -19,10 +20,6 @@ public static function getInfo() { ); } - public function setUp() { - parent::setUp('views'); - } - /** * Tests the default glossary view. */ diff --git a/lib/Drupal/views/Tests/HandlersTest.php b/lib/Drupal/views/Tests/HandlersTest.php index cae4efdd82f9..19605cf83bda 100644 --- a/lib/Drupal/views/Tests/HandlersTest.php +++ b/lib/Drupal/views/Tests/HandlersTest.php @@ -11,6 +11,7 @@ * Tests abstract handlers of views. */ class HandlersTest extends ViewsSqlTest { + public static function getInfo() { return array( 'name' => 'Handlers test', @@ -19,11 +20,6 @@ public static function getInfo() { ); } - protected function setUp() { - parent::setUp('views', 'views_ui'); - module_enable(array('views_ui')); - } - function testFilterInOperatorUi() { $admin_user = $this->drupalCreateUser(array('administer views', 'administer site configuration')); $this->drupalLogin($admin_user); diff --git a/lib/Drupal/views/Tests/PagerTest.php b/lib/Drupal/views/Tests/PagerTest.php index 196743816189..f3379a9a8490 100644 --- a/lib/Drupal/views/Tests/PagerTest.php +++ b/lib/Drupal/views/Tests/PagerTest.php @@ -13,6 +13,7 @@ * Tests the pluggable pager system. */ class PagerTest extends ViewsSqlTest { + public static function getInfo() { return array( 'name' => 'Pager', @@ -21,10 +22,6 @@ public static function getInfo() { ); } - public function setUp() { - parent::setUp('views', 'views_ui', 'views_test'); - } - /** * Pagers was sometimes not stored. * diff --git a/lib/Drupal/views/Tests/UiGroupByTest.php b/lib/Drupal/views/Tests/UiGroupByTest.php index 15768de1e041..06418781d762 100644 --- a/lib/Drupal/views/Tests/UiGroupByTest.php +++ b/lib/Drupal/views/Tests/UiGroupByTest.php @@ -13,11 +13,18 @@ * Tests UI of aggregate functionality.. */ class UiGroupByTest extends WebTestBase { + + /** + * Modules to enable. + * + * @var array + */ + public static $modules = array('views_ui', 'views_test'); + protected $profile = 'standard'; function setUp() { - // Enable views_ui. - parent::setUp('views_ui', 'views_test'); + parent::setUp(); // Create and log in a user with administer views permission. $views_admin = $this->drupalCreateUser(array('administer views', 'administer blocks', 'bypass node access', 'access user profiles', 'view revisions')); diff --git a/lib/Drupal/views/Tests/UiSettingsTest.php b/lib/Drupal/views/Tests/UiSettingsTest.php index 614e3d357131..2f36be30afd2 100644 --- a/lib/Drupal/views/Tests/UiSettingsTest.php +++ b/lib/Drupal/views/Tests/UiSettingsTest.php @@ -14,6 +14,13 @@ */ class UiSettingsTest extends WebTestBase { + /** + * Modules to enable. + * + * @var array + */ + public static $modules = array('views_ui'); + /** * Stores an admin user used by the different tests. * @@ -30,7 +37,8 @@ public static function getInfo() { } protected function setUp() { - parent::setUp('views', 'views_ui'); + parent::setUp(); + $this->adminUser = $this->drupalCreateUser(array('administer views')); } diff --git a/lib/Drupal/views/Tests/UpgradeTestCase.php b/lib/Drupal/views/Tests/UpgradeTestCase.php index e109d2288af2..d0e38ec5f65a 100644 --- a/lib/Drupal/views/Tests/UpgradeTestCase.php +++ b/lib/Drupal/views/Tests/UpgradeTestCase.php @@ -15,6 +15,17 @@ * You can find all conversions by searching for "moved to". */ class UpgradeTestCase extends ViewsSqlTest { + + /** + * Modules to enable. + * + * To import a view the user needs use PHP for settings rights, so enable php + * module. + * + * @var array + */ + public static $modules = array('php'); + public static function getInfo() { return array( 'name' => 'Views Upgrade test', @@ -24,10 +35,7 @@ public static function getInfo() { } protected function setUp() { -// // To import a view the user needs use PHP for settings rights, so enable php module. parent::setUp(); - - module_enable(array('php')); $this->resetAll(); } diff --git a/lib/Drupal/views/Tests/User/UserArgumentValidate.php b/lib/Drupal/views/Tests/User/UserArgumentValidate.php index 06c71e26fac8..d6e776d22558 100644 --- a/lib/Drupal/views/Tests/User/UserArgumentValidate.php +++ b/lib/Drupal/views/Tests/User/UserArgumentValidate.php @@ -14,6 +14,7 @@ * Tests views user argument argument handler. */ class UserArgumentValidate extends ViewsSqlTest { + public static function getInfo() { return array( 'name' => 'Tests user argument validator', @@ -23,7 +24,8 @@ public static function getInfo() { } function setUp() { - parent::setUp('views'); + parent::setUp(); + $this->account = $this->drupalCreateUser(); } diff --git a/lib/Drupal/views/Tests/ViewsSqlTest.php b/lib/Drupal/views/Tests/ViewsSqlTest.php index 69372901291f..bff82ccc9ba5 100644 --- a/lib/Drupal/views/Tests/ViewsSqlTest.php +++ b/lib/Drupal/views/Tests/ViewsSqlTest.php @@ -9,8 +9,15 @@ abstract class ViewsSqlTest extends ViewsTestBase { + /** + * Modules to enable. + * + * @var array + */ + public static $modules = array('views_ui'); + protected function setUp() { - parent::setUp('views', 'views_ui'); + parent::setUp(); // Define the schema and views data variable before enabling the test module. variable_set('views_test_schema', $this->schemaDefinition()); diff --git a/lib/Drupal/views/Tests/ViewsTestBase.php b/lib/Drupal/views/Tests/ViewsTestBase.php index d6f021a0adde..443ffa1ca582 100644 --- a/lib/Drupal/views/Tests/ViewsTestBase.php +++ b/lib/Drupal/views/Tests/ViewsTestBase.php @@ -12,6 +12,14 @@ * Abstract class for views testing. */ abstract class ViewsTestBase extends WebTestBase { + + /** + * Modules to enable. + * + * @var array + */ + public static $modules = array('views'); + /** * Helper function: verify a result set returned by view. * diff --git a/lib/Drupal/views/Tests/WizardTestBase.php b/lib/Drupal/views/Tests/WizardTestBase.php index 5f046e3550cc..6623101a2ff7 100644 --- a/lib/Drupal/views/Tests/WizardTestBase.php +++ b/lib/Drupal/views/Tests/WizardTestBase.php @@ -11,11 +11,11 @@ * Views UI wizard tests. */ abstract class WizardTestBase extends ViewsSqlTest { + protected $profile = 'standard'; function setUp() { - // Enable views_ui. - parent::setUp('views_ui'); + parent::setUp(); // Create and log in a user with administer views permission. $views_admin = $this->drupalCreateUser(array('administer views', 'administer blocks', 'bypass node access', 'access user profiles', 'view revisions')); -- GitLab