Commit f9c1ff23 authored by alexpott's avatar alexpott
Browse files

Issue #2314123 by sun: Fixed various tests.

parent 1d1ff757
......@@ -32,6 +32,8 @@ class BlockConfigSchemaTest extends KernelTestBase {
'forum',
'node',
'statistics',
// BlockManager->getModuleName() calls system_get_info().
'system',
'taxonomy',
);
......
......@@ -22,7 +22,7 @@ class CKEditorPluginManagerTest extends DrupalUnitTestBase {
*
* @var array
*/
public static $modules = array('system', 'editor', 'ckeditor');
public static $modules = array('system', 'user', 'filter', 'editor', 'ckeditor');
/**
* The manager for "CKEditor plugin" plugins.
......@@ -36,7 +36,6 @@ function setUp() {
// Install the Filter module.
$this->installSchema('system', 'url_alias');
$this->enableModules(array('user', 'filter'));
// Create text format, associate CKEditor.
$filtered_html_format = entity_create('filter_format', array(
......
......@@ -23,7 +23,7 @@ class CKEditorTest extends DrupalUnitTestBase {
*
* @var array
*/
public static $modules = array('system', 'editor', 'ckeditor', 'filter_test');
public static $modules = array('system', 'user', 'filter', 'editor', 'ckeditor', 'filter_test');
/**
* An instance of the "CKEditor" text editor plugin.
......@@ -44,7 +44,6 @@ function setUp() {
// Install the Filter module.
$this->installSchema('system', 'url_alias');
$this->enableModules(array('user', 'filter'));
// Create text format, associate CKEditor.
$filtered_html_format = entity_create('filter_format', array(
......
......@@ -24,7 +24,7 @@ class CommentDefaultFormatterCacheTagsTest extends EntityUnitTestBase {
*
* @var array
*/
public static $modules = array('entity_test', 'comment', 'menu_link');
public static $modules = array('entity_test', 'comment');
/**
* {@inheritdoc}
......
......@@ -29,6 +29,8 @@ class CommentStringIdEntitiesTest extends KernelTestBase {
'field_ui',
'entity',
'entity_test',
// EMAIL_MAX_LENGTH constant.
'system',
'text',
);
......
......@@ -71,6 +71,9 @@ public function testStorageMethods() {
// Ensure that the configuration entity can be loaded by UUID.
$entity_loaded_by_uuid = entity_load_by_uuid($entity_type->id(), $entity->uuid());
if (!$entity_loaded_by_uuid) {
$this->fail(sprintf("Failed to load '%s' entity ID '%s' by UUID '%s'.", $entity_type->id(), $entity->id(), $entity->uuid()));
}
// Compare UUIDs as the objects are not identical since
// $entity->enforceIsNew is FALSE and $entity_loaded_by_uuid->enforceIsNew
// is NULL.
......
......@@ -11,6 +11,7 @@
use Drupal\Core\Config\CachedStorage;
use Drupal\Core\Database\Database;
use Drupal\Core\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
/**
* Tests CachedStorage operations.
......@@ -89,7 +90,7 @@ public function containerBuild(ContainerBuilder $container) {
parent::containerBuild($container);
// Use the regular database cache backend to aid testing.
$container->register('cache_factory', 'Drupal\Core\Cache\DatabaseBackendFactory')
->addArgument(Database::getConnection());
->addArgument(new Reference('database'));
}
}
......@@ -28,6 +28,11 @@ abstract class ConfigStorageTestBase extends DrupalUnitTestBase {
*/
protected $storage;
/**
* @var \Drupal\Core\Config\StorageInterface;
*/
protected $invalidStorage;
/**
* Tests storage CRUD operations.
*
......
......@@ -46,7 +46,7 @@ protected function delete($name) {
/**
* Tests the FileStorage::listAll method with a relative and absolute path.
*/
protected function testlistAll() {
public function testlistAll() {
$expected_files = array(
'core.extension',
'system.performance',
......
......@@ -32,7 +32,7 @@ class ViewsIntegrationTest extends ViewUnitTestBase {
*
* @var array
*/
public static $modules = array('dblog_test_views');
public static $modules = array('dblog', 'dblog_test_views');
/**
* {@inheritdoc}
......@@ -40,7 +40,6 @@ class ViewsIntegrationTest extends ViewUnitTestBase {
protected function setUp() {
parent::setUp();
$this->enableModules(array('system', 'dblog'));
$this->installSchema('dblog', array('watchdog'));
ViewTestData::createTestViews(get_class($this), array('dblog_test_views'));
......
......@@ -22,7 +22,7 @@ class EditorManagerTest extends DrupalUnitTestBase {
*
* @var array
*/
public static $modules = array('system', 'editor');
public static $modules = array('system', 'user', 'filter', 'editor');
/**
* The manager for text editor plugins.
......@@ -36,7 +36,6 @@ public function setUp() {
// Install the Filter module.
$this->installSchema('system', 'url_alias');
$this->enableModules(array('user', 'filter'));
// Add text formats.
$filtered_html_format = entity_create('filter_format', array(
......
......@@ -24,6 +24,11 @@
*/
class QuickEditIntegrationTest extends QuickEditTestBase {
/**
* {@inheritdoc}
*/
public static $modules = array('editor', 'editor_test');
/**
* The manager for editor plug-ins.
*
......@@ -65,9 +70,6 @@ public function setUp() {
// Install the Filter module.
$this->installSchema('system', 'url_alias');
// Enable the Text Editor and Text Editor Test module.
$this->enableModules(array('editor', 'editor_test'));
// Create a field.
$this->field_name = 'field_textarea';
$this->createFieldWithInstance(
......
......@@ -16,7 +16,7 @@
*/
class EntityDisplayTest extends DrupalUnitTestBase {
public static $modules = array('entity', 'field', 'entity_test', 'user', 'text', 'entity_test');
public static $modules = array('entity', 'field', 'entity_test', 'user', 'text', 'field_test', 'node', 'system');
protected function setUp() {
parent::setUp();
......@@ -137,8 +137,6 @@ public function testExtraFieldComponent() {
* Tests the behavior of a field component within an entity display object.
*/
public function testFieldComponent() {
$this->enableModules(array('field_test'));
$field_name = 'test_field';
// Create a field storage and an instance.
$field_storage = entity_create('field_storage_config', array(
......@@ -264,7 +262,6 @@ public function testBaseFieldComponent() {
* Tests renaming and deleting a bundle.
*/
public function testRenameDeleteBundle() {
$this->enableModules(array('field_test', 'node', 'system', 'text'));
$this->installEntitySchema('node');
// Create a node bundle, display and form display object.
......@@ -314,8 +311,6 @@ public function testRenameDeleteBundle() {
* Tests deleting field instance.
*/
public function testDeleteFieldInstance() {
$this->enableModules(array('field_test'));
$field_name = 'test_field';
// Create a field storage and an instance.
$field_storage = entity_create('field_storage_config', array(
......
......@@ -16,7 +16,7 @@
*/
class EntityFormDisplayTest extends DrupalUnitTestBase {
public static $modules = array('entity', 'field', 'entity_test', 'user', 'text');
public static $modules = array('entity', 'field', 'entity_test', 'field_test', 'user', 'text');
protected function setUp() {
parent::setUp();
......@@ -47,8 +47,6 @@ public function testEntityGetFromDisplay() {
* Tests the behavior of a field component within an EntityFormDisplay object.
*/
public function testFieldComponent() {
$this->enableModules(array('field_test'));
// Create a field storage and an instance.
$field_name = 'test_field';
$field_storage = entity_create('field_storage_config', array(
......@@ -177,8 +175,6 @@ public function testBaseFieldComponent() {
* Tests deleting field instance.
*/
public function testDeleteFieldInstance() {
$this->enableModules(array('field_sql_storage', 'field_test'));
$field_name = 'test_field';
// Create a field storage and an instance.
$field_storage = entity_create('field_storage_config', array(
......
......@@ -18,13 +18,6 @@
*/
class EmailItemTest extends FieldUnitTestBase {
/**
* Modules to enable.
*
* @var array
*/
public static $modules = array('email');
public function setUp() {
parent::setUp();
......
......@@ -22,7 +22,7 @@ class FieldImportDeleteUninstallTest extends FieldUnitTestBase {
*
* @var array
*/
public static $modules = array('telephone', 'menu_link');
public static $modules = array('telephone');
public function setUp() {
parent::setUp();
......
......@@ -13,6 +13,17 @@
* @group file
*/
class ValidatorTest extends FileManagedUnitTestBase {
/**
* @var \Drupal\file\Entity\File
*/
protected $image;
/**
* @var \Drupal\file\Entity\File
*/
protected $non_image;
function setUp() {
parent::setUp();
......
......@@ -33,7 +33,7 @@ abstract class NormalizerTestBase extends DrupalUnitTestBase {
*
* @var array
*/
public static $modules = array('entity', 'entity_test', 'entity_reference', 'field', 'hal', 'language', 'rest', 'serialization', 'system', 'text', 'user', 'filter', 'menu_link');
public static $modules = array('entity', 'entity_test', 'entity_reference', 'field', 'hal', 'language', 'rest', 'serialization', 'system', 'text', 'user', 'filter');
/**
* The mock serializer.
......
......@@ -21,7 +21,7 @@ class NodeLastChangedTest extends DrupalUnitTestBase {
*
* @var array
*/
public static $modules = array('entity', 'user', 'node', 'field', 'text', 'filter');
public static $modules = array('entity', 'user', 'node', 'field', 'system', 'text', 'filter');
public function setUp() {
parent::setUp();
......
......@@ -20,6 +20,11 @@
*/
class MetadataGeneratorTest extends QuickEditTestBase {
/**
* {@inheritdoc}
*/
public static $modules = array('quickedit_test');
/**
* The manager for editor plugins.
*
......@@ -124,8 +129,6 @@ public function testSimpleEntityType() {
public function testEditorWithCustomMetadata() {
$this->installSchema('system', 'url_alias');
// Enable edit_test module so that the WYSIWYG editor becomes available.
$this->enableModules(array('quickedit_test'));
$this->editorManager = $this->container->get('plugin.manager.quickedit.editor');
$this->editorSelector = new EditorSelector($this->editorManager, $this->container->get('plugin.manager.field.formatter'));
$this->metadataGenerator = new MetadataGenerator($this->accessChecker, $this->editorSelector, $this->editorManager);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment