Commit 0e0e6b3d authored by catch's avatar catch

Issue #1541676 by Berdir, tstoeckler, Rob Loach: Convert Simpletest base test classes to PSR-0.

parent 352645e4
......@@ -17,7 +17,7 @@ function config_get_config_directory() {
global $config_directory_name;
if ($test_prefix = drupal_valid_test_ua()) {
// @see DrupalWebTestCase::setUp()
// @see Drupal\simpletest\WebTestBase::setUp()
$path = conf_path() . '/files/simpletest/' . substr($test_prefix, 10) . '/config';
}
else {
......
......@@ -5,7 +5,9 @@
* Tests for aggregator.module.
*/
class AggregatorTestCase extends DrupalWebTestCase {
use Drupal\simpletest\WebTestBase;
class AggregatorTestCase extends WebTestBase {
function setUp() {
parent::setUp(array('node', 'block', 'aggregator', 'aggregator_test'));
......
......@@ -5,7 +5,10 @@
* Tests for block.module.
*/
class BlockTestCase extends DrupalWebTestCase {
use Drupal\simpletest\WebTestBase;
use Drupal\simpletest\UnitTestBase;
class BlockTestCase extends WebTestBase {
protected $regions;
protected $admin_user;
......@@ -398,7 +401,7 @@ class BlockTestCase extends DrupalWebTestCase {
}
}
class NonDefaultBlockAdmin extends DrupalWebTestCase {
class NonDefaultBlockAdmin extends WebTestBase {
public static function getInfo() {
return array(
'name' => 'Non default theme admin',
......@@ -426,7 +429,7 @@ class NonDefaultBlockAdmin extends DrupalWebTestCase {
/**
* Test blocks correctly initialized when picking a new default theme.
*/
class NewDefaultThemeBlocks extends DrupalWebTestCase {
class NewDefaultThemeBlocks extends WebTestBase {
public static function getInfo() {
return array(
'name' => 'New default theme blocks',
......@@ -481,7 +484,7 @@ class NewDefaultThemeBlocks extends DrupalWebTestCase {
/**
* Test the block system with admin themes.
*/
class BlockAdminThemeTestCase extends DrupalWebTestCase {
class BlockAdminThemeTestCase extends WebTestBase {
public static function getInfo() {
return array(
'name' => 'Admin theme block admin accessibility',
......@@ -517,7 +520,7 @@ class BlockAdminThemeTestCase extends DrupalWebTestCase {
/**
* Test block caching.
*/
class BlockCacheTestCase extends DrupalWebTestCase {
class BlockCacheTestCase extends WebTestBase {
protected $admin_user;
protected $normal_user;
protected $normal_user_alt;
......@@ -704,7 +707,7 @@ class BlockCacheTestCase extends DrupalWebTestCase {
/**
* Test block HTML id validity.
*/
class BlockHTMLIdTestCase extends DrupalWebTestCase {
class BlockHTMLIdTestCase extends WebTestBase {
public static function getInfo() {
return array(
......@@ -743,7 +746,7 @@ class BlockHTMLIdTestCase extends DrupalWebTestCase {
/**
* Unit tests for template_preprocess_block().
*/
class BlockTemplateSuggestionsUnitTest extends DrupalUnitTestCase {
class BlockTemplateSuggestionsUnitTest extends UnitTestBase {
public static function getInfo() {
return array(
'name' => 'Block template suggestions',
......@@ -788,7 +791,7 @@ class BlockTemplateSuggestionsUnitTest extends DrupalUnitTestCase {
/**
* Tests that hidden regions do not inherit blocks when a theme is enabled.
*/
class BlockHiddenRegionTestCase extends DrupalWebTestCase {
class BlockHiddenRegionTestCase extends WebTestBase {
public static function getInfo() {
return array(
'name' => 'Blocks not in hidden region',
......@@ -848,7 +851,7 @@ class BlockHiddenRegionTestCase extends DrupalWebTestCase {
/**
* Functional tests for the language list configuration forms.
*/
class BlockLanguageTestCase extends DrupalWebTestCase {
class BlockLanguageTestCase extends WebTestBase {
public static function getInfo() {
return array(
'name' => 'Language block visibility',
......@@ -1034,7 +1037,7 @@ class BlockLanguageTestCase extends DrupalWebTestCase {
/**
* Tests that a block assigned to an invalid region triggers the warning.
*/
class BlockInvalidRegionTestCase extends DrupalWebTestCase {
class BlockInvalidRegionTestCase extends WebTestBase {
public static function getInfo() {
return array(
'name' => 'Blocks in invalid regions',
......
......@@ -6,8 +6,9 @@
*/
use Drupal\node\Node;
use Drupal\simpletest\WebTestBase;
class BookTestCase extends DrupalWebTestCase {
class BookTestCase extends WebTestBase {
protected $book;
// $book_author is a user with permission to create and edit books.
protected $book_author;
......
......@@ -5,10 +5,12 @@
* Tests for color module.
*/
use Drupal\simpletest\WebTestBase;
/**
* Tests the Color module functionality.
*/
class ColorTestCase extends DrupalWebTestCase {
class ColorTestCase extends WebTestBase {
protected $big_user;
protected $themes;
protected $colorTests;
......
......@@ -6,8 +6,9 @@
*/
use Drupal\comment\Comment;
use Drupal\simpletest\WebTestBase;
class CommentHelperCase extends DrupalWebTestCase {
class CommentHelperCase extends WebTestBase {
protected $profile = 'standard';
protected $admin_user;
......@@ -818,7 +819,7 @@ class CommentInterfaceTest extends CommentHelperCase {
user_role_change_permissions($rid, $perms);
// Output verbose debugging information.
// @see DrupalTestCase::error()
// @see Drupal\simpletest\TestBase::error()
$t_form = array(
COMMENT_FORM_BELOW => 'below',
COMMENT_FORM_SEPARATE_PAGE => 'separate page',
......@@ -1515,7 +1516,7 @@ class CommentNodeAccessTest extends CommentHelperCase {
}
function setUp() {
DrupalWebTestCase::setUp('comment', 'search', 'node_access_test');
WebTestBase::setUp('comment', 'search', 'node_access_test');
node_access_rebuild();
// Create users and test node.
......
......@@ -6,11 +6,12 @@
*/
use Drupal\Core\Config\FileStorage;
use Drupal\simpletest\WebTestBase;
/**
* Tests the secure file writer.
*/
class ConfigFileSecurityTestCase extends DrupalWebTestCase {
class ConfigFileSecurityTestCase extends WebTestBase {
protected $filename = 'foo.bar';
protected $testContent = 'Good morning, Denver!';
......@@ -50,7 +51,7 @@ class ConfigFileSecurityTestCase extends DrupalWebTestCase {
/**
* Tests reading and writing file contents.
*/
class ConfigFileContentTestCase extends DrupalWebTestCase {
class ConfigFileContentTestCase extends WebTestBase {
protected $fileExtension = 'xml';
public static function getInfo() {
......@@ -231,7 +232,7 @@ class ConfigFileContentTestCase extends DrupalWebTestCase {
/**
* Tests configuration overriding from settings.php.
*/
class ConfOverrideTestCase extends DrupalWebTestCase {
class ConfOverrideTestCase extends WebTestBase {
protected $testContent = 'Good morning, Denver!';
public static function getInfo() {
......@@ -259,7 +260,7 @@ class ConfOverrideTestCase extends DrupalWebTestCase {
/**
* Tests function providing configuration upgrade from Drupal 7 to 8.
*/
class ConfUpdate7to8TestCase extends DrupalWebTestCase {
class ConfUpdate7to8TestCase extends WebTestBase {
protected $testContent = 'Olá, Sao Paulo!';
public static function getInfo() {
......
......@@ -4,10 +4,12 @@
* Tests for the Contact module.
*/
use Drupal\simpletest\WebTestBase;
/**
* Tests the site-wide contact form.
*/
class ContactSitewideTestCase extends DrupalWebTestCase {
class ContactSitewideTestCase extends WebTestBase {
public static function getInfo() {
return array(
'name' => 'Site-wide contact form',
......@@ -298,7 +300,7 @@ class ContactSitewideTestCase extends DrupalWebTestCase {
/**
* Tests the personal contact form.
*/
class ContactPersonalTestCase extends DrupalWebTestCase {
class ContactPersonalTestCase extends WebTestBase {
private $admin_user;
private $web_user;
private $contact_user;
......
......@@ -5,10 +5,12 @@
* Tests for contextual.module.
*/
use Drupal\simpletest\WebTestBase;
/**
* Tests accessible links after inaccessible links on dynamic context.
*/
class ContextualDynamicContextTestCase extends DrupalWebTestCase {
class ContextualDynamicContextTestCase extends WebTestBase {
public static function getInfo() {
return array(
'name' => 'Contextual links on node lists',
......
......@@ -5,10 +5,13 @@
* Tests for dashboard.module.
*/
use Drupal\simpletest\WebTestBase;
/**
* Tests the Dashboard module blocks.
*/
class DashboardBlocksTestCase extends DrupalWebTestCase {
class DashboardBlocksTestCase extends WebTestBase {
public static function getInfo() {
return array(
'name' => 'Dashboard blocks',
......@@ -106,7 +109,7 @@ class DashboardBlocksTestCase extends DrupalWebTestCase {
}
}
class DashboardBlockAvailabilityTestCase extends DrupalWebTestCase {
class DashboardBlockAvailabilityTestCase extends WebTestBase {
protected $profile = 'standard';
public static function getInfo() {
......
......@@ -5,7 +5,10 @@
* Tests for dblog.module.
*/
class DBLogTestCase extends DrupalWebTestCase {
use Drupal\simpletest\WebTestBase;
class DBLogTestCase extends WebTestBase {
protected $profile = 'standard';
protected $big_user;
......
......@@ -5,10 +5,12 @@
* Entity CRUD API tests.
*/
use Drupal\simpletest\WebTestBase;
/**
* Tests the basic Entity API.
*/
class EntityAPITestCase extends DrupalWebTestCase {
class EntityAPITestCase extends WebTestBase {
public static function getInfo() {
return array(
......@@ -92,7 +94,7 @@ class EntityAPITestCase extends DrupalWebTestCase {
/**
* Tests entity translation.
*/
class EntityTranslationTestCase extends DrupalWebTestCase {
class EntityTranslationTestCase extends WebTestBase {
public static function getInfo() {
return array(
......@@ -201,7 +203,7 @@ class EntityTranslationTestCase extends DrupalWebTestCase {
/**
* Tests Entity API base functionality.
*/
class EntityAPIInfoTestCase extends DrupalWebTestCase {
class EntityAPIInfoTestCase extends WebTestBase {
public static function getInfo() {
return array(
......
......@@ -5,6 +5,8 @@
* CRUD hook tests for the Entity CRUD API.
*/
use Drupal\simpletest\WebTestBase;
/**
* Tests invocation of hooks when performing an action.
*
......@@ -17,7 +19,7 @@
* As well as all type-specific hooks, like hook_node_insert(),
* hook_comment_update(), etc.
*/
class EntityCrudHookTestCase extends DrupalWebTestCase {
class EntityCrudHookTestCase extends WebTestBase {
protected $ids = array();
......
......@@ -5,10 +5,12 @@
* Unit test file for the entity API.
*/
use Drupal\simpletest\WebTestBase;
/**
* Tests EntityFieldQuery.
*/
class EntityFieldQueryTestCase extends DrupalWebTestCase {
class EntityFieldQueryTestCase extends WebTestBase {
public static function getInfo() {
......
......@@ -2,6 +2,7 @@
use Drupal\Core\Database\Database;
use Drupal\field\FieldException;
use Drupal\simpletest\WebTestBase;
/**
* @file
......@@ -14,7 +15,7 @@ use Drupal\field\FieldException;
/**
* Tests field storage.
*/
class FieldSqlStorageTestCase extends DrupalWebTestCase {
class FieldSqlStorageTestCase extends WebTestBase {
public static function getInfo() {
return array(
'name' => 'Field SQL Storage tests',
......
......@@ -5,10 +5,12 @@
* Tests for number.module.
*/
use Drupal\simpletest\WebTestBase;
/**
* Tests for number field types.
*/
class NumberFieldTestCase extends DrupalWebTestCase {
class NumberFieldTestCase extends WebTestBase {
protected $field;
protected $instance;
protected $web_user;
......
......@@ -6,8 +6,9 @@
*/
use Drupal\field\FieldValidationException;
use Drupal\simpletest\WebTestBase;
class TextFieldTestCase extends DrupalWebTestCase {
class TextFieldTestCase extends WebTestBase {
protected $instance;
protected $admin_user;
protected $web_user;
......@@ -239,7 +240,7 @@ class TextFieldTestCase extends DrupalWebTestCase {
}
}
class TextSummaryTestCase extends DrupalWebTestCase {
class TextSummaryTestCase extends WebTestBase {
protected $profile = 'standard';
public static function getInfo() {
......@@ -409,7 +410,7 @@ class TextSummaryTestCase extends DrupalWebTestCase {
}
}
class TextTranslationTestCase extends DrupalWebTestCase {
class TextTranslationTestCase extends WebTestBase {
protected $profile = 'standard';
public static function getInfo() {
......
......@@ -7,11 +7,12 @@
use Drupal\field\FieldException;
use Drupal\field\FieldValidationException;
use Drupal\simpletest\WebTestBase;
/**
* Parent class for Field API tests.
*/
class FieldTestCase extends DrupalWebTestCase {
class FieldTestCase extends WebTestBase {
var $default_storage = 'field_sql_storage';
/**
......@@ -19,8 +20,9 @@ class FieldTestCase extends DrupalWebTestCase {
*/
function setUp() {
// Since this is a base class for many test cases, support the same
// flexibility that DrupalWebTestCase::setUp() has for the modules to be
// passed in as either an array or a variable number of string arguments.
// flexibility that Drupal\simpletest\WebTestBase::setUp() has for the
// modules to be passed in as either an array or a variable number of string
// arguments.
$modules = func_get_args();
if (isset($modules[0]) && is_array($modules[0])) {
$modules = $modules[0];
......@@ -77,8 +79,9 @@ class FieldTestCase extends DrupalWebTestCase {
class FieldAttachTestCase extends FieldTestCase {
function setUp() {
// Since this is a base class for many test cases, support the same
// flexibility that DrupalWebTestCase::setUp() has for the modules to be
// passed in as either an array or a variable number of string arguments.
// flexibility that Drupal\simpletest\WebTestBase::setUp() has for the
// modules to be passed in as either an array or a variable number of string
// arguments.
$modules = func_get_args();
if (isset($modules[0]) && is_array($modules[0])) {
$modules = $modules[0];
......
......@@ -6,16 +6,18 @@
*/
use Drupal\node\Node;
use Drupal\simpletest\WebTestBase;
/**
* Provides common functionality for the Field UI test classes.
*/
class FieldUITestCase extends DrupalWebTestCase {
class FieldUITestCase extends WebTestBase {
function setUp() {
// Since this is a base class for many test cases, support the same
// flexibility that DrupalWebTestCase::setUp() has for the modules to be
// passed in as either an array or a variable number of string arguments.
// flexibility that Drupal\simpletest\WebTestBase::setUp() has for the
// modules to be passed in as either an array or a variable number of string
// arguments.
$modules = func_get_args();
if (isset($modules[0]) && is_array($modules[0])) {
$modules = $modules[0];
......@@ -681,7 +683,7 @@ class FieldUIManageDisplayTestCase extends FieldUITestCase {
$output = drupal_render($element);
$this->verbose(t('Rendered node - view mode: @view_mode', array('@view_mode' => $view_mode)) . '<hr />'. $output);
// Assign content so that DrupalWebTestCase functions can be used.
// Assign content so that WebTestBase functions can be used.
$this->drupalSetContent($output);
$method = ($not_exists ? 'assertNoText' : 'assertText');
$return = $this->{$method}((string) $text, $message);
......@@ -696,7 +698,7 @@ class FieldUIManageDisplayTestCase extends FieldUITestCase {
/**
* Tests custom widget hooks and callbacks on the field administration pages.
*/
class FieldUIAlterTestCase extends DrupalWebTestCase {
class FieldUIAlterTestCase extends WebTestBase {
public static function getInfo() {
return array(
'name' => 'Widget customization',
......
......@@ -5,18 +5,21 @@
* Tests for file.module.
*/
use Drupal\simpletest\WebTestBase;
/**
* Provides methods specifically for testing File module's field handling.
*/
class FileFieldTestCase extends DrupalWebTestCase {
class FileFieldTestCase extends WebTestBase {
protected $profile = 'standard';
protected $admin_user;
function setUp() {
// Since this is a base class for many test cases, support the same
// flexibility that DrupalWebTestCase::setUp() has for the modules to be
// passed in as either an array or a variable number of string arguments.
// flexibility that Drupal\simpletest\WebTestBase::setUp() has for the
// modules to be passed in as either an array or a variable number of string
// arguments.
$modules = func_get_args();
if (isset($modules[0]) && is_array($modules[0])) {
$modules = $modules[0];
......
......@@ -5,10 +5,13 @@
* Tests for filter.module.
*/
use Drupal\simpletest\WebTestBase;
use Drupal\simpletest\UnitTestBase;
/**
* Tests for text format and filter CRUD operations.
*/
class FilterCRUDTestCase extends DrupalWebTestCase {
class FilterCRUDTestCase extends WebTestBase {
public static function getInfo() {
return array(
'name' => 'Filter CRUD operations',
......@@ -160,7 +163,7 @@ class FilterCRUDTestCase extends DrupalWebTestCase {
}
}
class FilterAdminTestCase extends DrupalWebTestCase {
class FilterAdminTestCase extends WebTestBase {
protected $profile = 'standard';
public static function getInfo() {
......@@ -415,7 +418,7 @@ class FilterAdminTestCase extends DrupalWebTestCase {
}
}
class FilterFormatAccessTestCase extends DrupalWebTestCase {
class FilterFormatAccessTestCase extends WebTestBase {
protected $admin_user;
protected $filter_admin_user;
protected $web_user;
......@@ -662,7 +665,7 @@ class FilterFormatAccessTestCase extends DrupalWebTestCase {
}
}
class FilterDefaultFormatTestCase extends DrupalWebTestCase {
class FilterDefaultFormatTestCase extends WebTestBase {
public static function getInfo() {
return array(
'name' => 'Default text format functionality',
......@@ -722,7 +725,7 @@ class FilterDefaultFormatTestCase extends DrupalWebTestCase {
}
}
class FilterNoFormatTestCase extends DrupalWebTestCase {
class FilterNoFormatTestCase extends WebTestBase {
public static function getInfo() {
return array(
'name' => 'Unassigned text format functionality',
......@@ -745,7 +748,7 @@ class FilterNoFormatTestCase extends DrupalWebTestCase {
/**
* Security tests for missing/vanished text formats or filters.
*/
class FilterSecurityTestCase extends DrupalWebTestCase {
class FilterSecurityTestCase extends WebTestBase {
public static function getInfo() {
return array(
'name' => 'Security',
......@@ -809,7 +812,7 @@ class FilterSecurityTestCase extends DrupalWebTestCase {
/**
* Unit tests for core filters.
*/
class FilterUnitTestCase extends DrupalUnitTestCase {
class FilterUnitTestCase extends UnitTestBase {
public static function getInfo() {
return array(
'name' => 'Filter module filters',
......@@ -1795,7 +1798,7 @@ body {color:red}
/**
* Tests for filter hook invocation.
*/
class FilterHooksTestCase extends DrupalWebTestCase {
class FilterHooksTestCase extends WebTestBase {
public static function getInfo() {
return array(
'name' => 'Filter format hooks',
......@@ -1857,7 +1860,7 @@ class FilterHooksTestCase extends DrupalWebTestCase {
/**
* Tests filter settings.
*/
class FilterSettingsTestCase extends DrupalWebTestCase {
class FilterSettingsTestCase extends WebTestBase {
protected $profile = 'testing';
public static function getInfo() {
......
......@@ -6,8 +6,9 @@
*/
use Drupal\node\Node;
use Drupal\simpletest\WebTestBase;
class ForumTestCase extends DrupalWebTestCase {
class ForumTestCase extends WebTestBase {
protected $admin_user;
protected $edit_own_topics_user;
protected $edit_any_topics_user;
......@@ -594,7 +595,7 @@ class ForumTestCase extends DrupalWebTestCase {
/**
* Tests the forum index listing.
*/
class ForumIndexTestCase extends DrupalWebTestCase {
class ForumIndexTestCase extends WebTestBase {
public static function getInfo() {
return array(
......
......@@ -5,10 +5,12 @@
* Tests for help.module.
*/
use Drupal\simpletest\WebTestBase;
/**
* Tests help display and user access for all modules implementing help.
*/
class HelpTestCase extends DrupalWebTestCase {
class HelpTestCase extends WebTestBase {
// Tests help implementations of many arbitrary core modules.
protected $profile = 'standard';
......@@ -108,7 +110,7 @@ class HelpTestCase extends DrupalWebTestCase {
/**
* Tests a module without help to verify it is not listed in the help page.
*/
class NoHelpTestCase extends DrupalWebTestCase {
class NoHelpTestCase extends WebTestBase {
/**
* The user who will be created.
*/
......
......@@ -5,6 +5,9 @@
* Tests for image.module.
*/
use Drupal\simpletest\WebTestBase;
use Drupal\simpletest\UnitTestBase;
/**
* TODO: Test the following functions.
*
......@@ -28,7 +31,7 @@
/**
* This class provides methods specifically for testing Image's field handling.
*/
class ImageFieldTestCase extends DrupalWebTestCase {
class ImageFieldTestCase extends WebTestBase {
protected $admin_user;
function setUp() {
......@@ -118,7 +121,7 @@ class ImageFieldTestCase extends DrupalWebTestCase {
/**
* Tests the functions for generating paths and URLs for image styles.
*/
class ImageStylesPathAndUrlUnitTest extends DrupalWebTestCase {
class ImageStylesPathAndUrlUnitTest extends WebTestBase {
protected $style_name;
protected $image_info;
protected $image_filepath;
......@@ -901,7 +904,7 @@ class ImageFieldValidateTestCase extends ImageFieldTestCase {
/**
* Tests that images have correct dimensions when styled.
*/
class ImageDimensionsUnitTest extends DrupalWebTestCase {
class ImageDimensionsUnitTest extends WebTestBase {
protected $profile = 'testing';
public static function getInfo() {
......@@ -1124,7 +1127,7 @@ class ImageDimensionsUnitTest extends DrupalWebTestCase {
/**
* Tests image_dimensions_scale().
*/
class ImageDimensionsScaleTestCase extends DrupalUnitTestCase {
class ImageDimensionsScaleTestCase extends UnitTestBase {
public static function getInfo() {
return array(
'name' => 'image_dimensions_scale()',
......
......@@ -10,10 +10,12 @@ use Drupal\Core\DependencyInjection\ContainerBuilder;
* - comparison of $GLOBALS default language against dependency injection;
*/
use Drupal\simpletest\WebTestBase;
/**
* Functional tests for the language list configuration forms.
*/
class LanguageListTest extends DrupalWebTestCase {
class LanguageListTest extends WebTestBase {
public static function getInfo() {
return array(
'name' => 'Language list configuration',
......@@ -168,7 +170,7 @@ class LanguageListTest extends DrupalWebTestCase {
/**
* Test for dependency injected language object.
*/
class LanguageDependencyInjectionTest extends DrupalWebTestCase {
class LanguageDependencyInjectionTest extends WebTestBase {
public static function getInfo() {
return array(
'name' => 'Language dependency injection',
......
......@@ -20,11 +20,13 @@
* - a functional test fot language types/negotiation info.
*/
use Drupal\simpletest\WebTestBase;
use Drupal\simpletest\UnitTestBase;
/**
* Functional tests for language configuration's effect on negotiation setup.
*/
class LocaleConfigurationTest extends DrupalWebTestCase {
class LocaleConfigurationTest extends WebTestBase {
public static function getInfo() {
return array(
'name' => 'Language negotiation autoconfiguration',
......@@ -90,7 +92,7 @@ class LocaleConfigurationTest extends DrupalWebTestCase {
/**
* Functional tests for JavaScript parsing for translatable strings.
*/
class LocaleJavascriptTranslationTest extends DrupalWebTestCase {
class LocaleJavascriptTranslationTest extends WebTestBase {
public static function getInfo() {
return array