Update to Drupal 8.1.1. For more information, see https://www.drupal.org/node/2718713
This commit is contained in:
parent
c0a0d5a94c
commit
9eae24d844
669 changed files with 3873 additions and 1553 deletions
|
@ -112,4 +112,3 @@ class DefaultConfigTest extends KernelTestBase {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -686,4 +686,98 @@ class ConfigImporterTest extends KernelTestBase {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests the isSyncing flags.
|
||||
*/
|
||||
public function testIsSyncingInHooks() {
|
||||
$dynamic_name = 'config_test.dynamic.dotted.default';
|
||||
$storage = $this->container->get('config.storage');
|
||||
|
||||
// Verify the default configuration values exist.
|
||||
$config = $this->config($dynamic_name);
|
||||
$this->assertSame('dotted.default', $config->get('id'));
|
||||
|
||||
// Delete the config so that create hooks will fire.
|
||||
$storage->delete($dynamic_name);
|
||||
\Drupal::state()->set('config_test.store_isSyncing', []);
|
||||
$this->configImporter->reset()->import();
|
||||
|
||||
// The values of the syncing values should be stored in state by
|
||||
// config_test_config_test_create().
|
||||
$state = \Drupal::state()->get('config_test.store_isSyncing');
|
||||
$this->assertTrue($state['global_state::create'], '\Drupal::isConfigSyncing() returns TRUE');
|
||||
$this->assertTrue($state['entity_state::create'], 'ConfigEntity::isSyncing() returns TRUE');
|
||||
$this->assertTrue($state['global_state::presave'], '\Drupal::isConfigSyncing() returns TRUE');
|
||||
$this->assertTrue($state['entity_state::presave'], 'ConfigEntity::isSyncing() returns TRUE');
|
||||
$this->assertTrue($state['global_state::insert'], '\Drupal::isConfigSyncing() returns TRUE');
|
||||
$this->assertTrue($state['entity_state::insert'], 'ConfigEntity::isSyncing() returns TRUE');
|
||||
|
||||
// Cause a config update so update hooks will fire.
|
||||
$config = $this->config($dynamic_name);
|
||||
$config->set('label', 'A new name')->save();
|
||||
\Drupal::state()->set('config_test.store_isSyncing', []);
|
||||
$this->configImporter->reset()->import();
|
||||
|
||||
// The values of the syncing values should be stored in state by
|
||||
// config_test_config_test_create().
|
||||
$state = \Drupal::state()->get('config_test.store_isSyncing');
|
||||
$this->assertTrue($state['global_state::presave'], '\Drupal::isConfigSyncing() returns TRUE');
|
||||
$this->assertTrue($state['entity_state::presave'], 'ConfigEntity::isSyncing() returns TRUE');
|
||||
$this->assertTrue($state['global_state::update'], '\Drupal::isConfigSyncing() returns TRUE');
|
||||
$this->assertTrue($state['entity_state::update'], 'ConfigEntity::isSyncing() returns TRUE');
|
||||
|
||||
// Cause a config delete so delete hooks will fire.
|
||||
$sync = $this->container->get('config.storage.sync');
|
||||
$sync->delete($dynamic_name);
|
||||
\Drupal::state()->set('config_test.store_isSyncing', []);
|
||||
$this->configImporter->reset()->import();
|
||||
|
||||
// The values of the syncing values should be stored in state by
|
||||
// config_test_config_test_create().
|
||||
$state = \Drupal::state()->get('config_test.store_isSyncing');
|
||||
$this->assertTrue($state['global_state::predelete'], '\Drupal::isConfigSyncing() returns TRUE');
|
||||
$this->assertTrue($state['entity_state::predelete'], 'ConfigEntity::isSyncing() returns TRUE');
|
||||
$this->assertTrue($state['global_state::delete'], '\Drupal::isConfigSyncing() returns TRUE');
|
||||
$this->assertTrue($state['entity_state::delete'], 'ConfigEntity::isSyncing() returns TRUE');
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests that the isConfigSyncing flag is cleanup after an invalid step.
|
||||
*/
|
||||
public function testInvalidStep() {
|
||||
$this->assertFalse(\Drupal::isConfigSyncing(), 'Before an import \Drupal::isConfigSyncing() returns FALSE');
|
||||
$context = [];
|
||||
try {
|
||||
$this->configImporter->doSyncStep('a_non_existent_step', $context);
|
||||
$this->fail('Expected \InvalidArgumentException thrown');
|
||||
}
|
||||
catch (\InvalidArgumentException $e) {
|
||||
$this->pass('Expected \InvalidArgumentException thrown');
|
||||
}
|
||||
$this->assertFalse(\Drupal::isConfigSyncing(), 'After an invalid step \Drupal::isConfigSyncing() returns FALSE');
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests that the isConfigSyncing flag is set correctly during a custom step.
|
||||
*/
|
||||
public function testCustomStep() {
|
||||
$this->assertFalse(\Drupal::isConfigSyncing(), 'Before an import \Drupal::isConfigSyncing() returns FALSE');
|
||||
$context = [];
|
||||
$this->configImporter->doSyncStep([self::class, 'customStep'], $context);
|
||||
$this->assertTrue($context['is_syncing'], 'Inside a custom step \Drupal::isConfigSyncing() returns TRUE');
|
||||
$this->assertFalse(\Drupal::isConfigSyncing(), 'After an valid custom step \Drupal::isConfigSyncing() returns FALSE');
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper meothd to test custom config installer steps.
|
||||
*
|
||||
* @param array $context
|
||||
* Batch context.
|
||||
* @param \Drupal\Core\Config\ConfigImporter $importer
|
||||
* The config importer.
|
||||
*/
|
||||
public static function customStep(array &$context, ConfigImporter $importer) {
|
||||
$context['is_syncing'] = \Drupal::isConfigSyncing();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -117,4 +117,3 @@ class ConfigLanguageOverrideTest extends KernelTestBase {
|
|||
$this->assertEqual($override->get('value'), NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ class ConfigOverridesPriorityTest extends KernelTestBase {
|
|||
public function testOverridePriorities() {
|
||||
$GLOBALS['config_test_run_module_overrides'] = FALSE;
|
||||
|
||||
$non_overridden_mail = 'site@example.com';
|
||||
$non_overridden_mail = 'site@example.com';
|
||||
$language_overridden_mail = 'french@example.com';
|
||||
|
||||
$language_overridden_name = 'French site name';
|
||||
|
|
|
@ -95,7 +95,7 @@ class ConfigSchemaTest extends KernelTestBase {
|
|||
$expected['label'] = 'Maintenance mode';
|
||||
$expected['class'] = '\Drupal\Core\Config\Schema\Mapping';
|
||||
$expected['mapping']['message'] = array(
|
||||
'label' => 'Message to display when in maintenance mode',
|
||||
'label' => 'Message to display when in maintenance mode',
|
||||
'type' => 'text',
|
||||
);
|
||||
$expected['mapping']['langcode'] = array(
|
||||
|
@ -119,7 +119,7 @@ class ConfigSchemaTest extends KernelTestBase {
|
|||
);
|
||||
$expected['mapping']['_core']['type'] = '_core_config_info';
|
||||
$expected['mapping']['label'] = array(
|
||||
'label' => 'Label',
|
||||
'label' => 'Label',
|
||||
'type' => 'label',
|
||||
);
|
||||
$expected['mapping']['irrelevant'] = array(
|
||||
|
@ -204,7 +204,7 @@ class ConfigSchemaTest extends KernelTestBase {
|
|||
$effects = \Drupal::service('config.typed')->get('image.style.medium')->get('effects');
|
||||
$definition = $effects->get('bddf0d06-42f9-4c75-a700-a33cafa25ea0')->get('data')->getDataDefinition()->toArray();
|
||||
// This should be the schema for image.effect.image_scale, reuse previous one.
|
||||
$expected['type'] = 'image.effect.image_scale';
|
||||
$expected['type'] = 'image.effect.image_scale';
|
||||
|
||||
$this->assertEqual($definition, $expected, 'Retrieved the right metadata for the first effect of image.style.medium');
|
||||
|
||||
|
|
|
@ -103,7 +103,7 @@ class AlterTest extends DatabaseTestBase {
|
|||
$record = $result->fetch();
|
||||
|
||||
$this->assertEqual($record->$name_field, 'George', 'Fetched name is correct.');
|
||||
$this->assertEqual($record->$age_field, 27*3, 'Fetched age expression is correct.');
|
||||
$this->assertEqual($record->$age_field, 27 * 3, 'Fetched age expression is correct.');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -145,6 +145,6 @@ class AlterTest extends DatabaseTestBase {
|
|||
|
||||
$record = $query->execute()->fetch();
|
||||
$this->assertEqual($record->$name_field, 'George', 'Fetched name is correct.');
|
||||
$this->assertEqual($record->$age_field, 27*3, 'Fetched age expression is correct.');
|
||||
$this->assertEqual($record->$age_field, 27 * 3, 'Fetched age expression is correct.');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -427,7 +427,7 @@ class SchemaTest extends KernelTestBase {
|
|||
// Now set up columns for the other types.
|
||||
$types = array('int', 'float', 'numeric');
|
||||
foreach ($types as $type) {
|
||||
$column_spec = array('type' => $type, 'unsigned'=> TRUE);
|
||||
$column_spec = array('type' => $type, 'unsigned' => TRUE);
|
||||
if ($type == 'numeric') {
|
||||
$column_spec += array('precision' => 10, 'scale' => 0);
|
||||
}
|
||||
|
|
|
@ -133,7 +133,7 @@ class SelectTest extends DatabaseTestBase {
|
|||
// Ensure that we got the right record.
|
||||
$record = $result->fetch();
|
||||
$this->assertEqual($record->$name_field, 'George', 'Fetched name is correct.');
|
||||
$this->assertEqual($record->$age_field, 27*2, 'Fetched age expression is correct.');
|
||||
$this->assertEqual($record->$age_field, 27 * 2, 'Fetched age expression is correct.');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -154,8 +154,8 @@ class SelectTest extends DatabaseTestBase {
|
|||
// Ensure that we got the right record.
|
||||
$record = $result->fetch();
|
||||
$this->assertEqual($record->$name_field, 'George', 'Fetched name is correct.');
|
||||
$this->assertEqual($record->$age_double_field, 27*2, 'Fetched double age expression is correct.');
|
||||
$this->assertEqual($record->$age_triple_field, 27*3, 'Fetched triple age expression is correct.');
|
||||
$this->assertEqual($record->$age_double_field, 27 * 2, 'Fetched double age expression is correct.');
|
||||
$this->assertEqual($record->$age_triple_field, 27 * 3, 'Fetched triple age expression is correct.');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -137,7 +137,7 @@ class UpdateTest extends DatabaseTestBase {
|
|||
->execute();
|
||||
$this->assertIdentical($num_updated, 1, 'Updated 1 record.');
|
||||
|
||||
$saved_name= db_query('SELECT name FROM {test} WHERE id = :id', array(':id' => 42))->fetchField();
|
||||
$saved_name = db_query('SELECT name FROM {test} WHERE id = :id', array(':id' => 42))->fetchField();
|
||||
$this->assertIdentical($saved_name, 'John', 'Updated primary key successfully.');
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,177 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\KernelTests\Core\Entity;
|
||||
|
||||
use Drupal\entity_test\Entity\EntityTestMulRev;
|
||||
use Drupal\entity_test\Entity\EntityTestRev;
|
||||
use Drupal\language\Entity\ConfigurableLanguage;
|
||||
|
||||
/**
|
||||
* Tests non-revisionable fields on revisionable (and translatable) entities.
|
||||
*
|
||||
* @group Entity
|
||||
*/
|
||||
class ContentEntityNonRevisionableFieldTest extends EntityKernelTestBase {
|
||||
|
||||
/**
|
||||
* Modules to enable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $modules = ['language'];
|
||||
|
||||
/**
|
||||
* The EntityTestMulRev entity type storage.
|
||||
*
|
||||
* @var \Drupal\Core\Entity\EntityStorageInterface
|
||||
*/
|
||||
protected $mulRev;
|
||||
|
||||
/**
|
||||
* The EntityTestRev entity type storage.
|
||||
*
|
||||
* @var \Drupal\Core\Entity\EntityStorageInterface
|
||||
*/
|
||||
protected $rev;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
// Enable an additional language.
|
||||
ConfigurableLanguage::createFromLangcode('de')->save();
|
||||
|
||||
$this->installEntitySchema('entity_test_mulrev');
|
||||
$this->installEntitySchema('entity_test_rev');
|
||||
$this->mulRev = $this->entityManager->getStorage('entity_test_mulrev');
|
||||
$this->rev = $this->entityManager->getStorage('entity_test_rev');
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests non-revisionable fields on revisionable and translatable entities.
|
||||
*/
|
||||
public function testMulNonRevisionableField() {
|
||||
$user1 = $this->createUser();
|
||||
$user2 = $this->createUser();
|
||||
|
||||
// Create a test entity.
|
||||
$entity = EntityTestMulRev::create(array(
|
||||
'name' => $this->randomString(),
|
||||
'user_id' => $user1->id(),
|
||||
'language' => 'en',
|
||||
'non_rev_field' => 'Huron',
|
||||
));
|
||||
$entity->save();
|
||||
|
||||
// Create a test entity.
|
||||
$entity2 = EntityTestMulRev::create(array(
|
||||
'name' => $this->randomString(),
|
||||
'user_id' => $user1->id(),
|
||||
'language' => 'en',
|
||||
'non_rev_field' => 'Michigan',
|
||||
));
|
||||
$entity2->save();
|
||||
|
||||
$this->assertEquals('Huron', $entity->get('non_rev_field')->value, 'Huron found on entity 1');
|
||||
$this->assertEquals('Michigan', $entity2->get('non_rev_field')->value, 'Michigan found on entity 2');
|
||||
|
||||
$entity->setNewRevision();
|
||||
$entity->setOwner($user2);
|
||||
$entity->save();
|
||||
$entity2->setNewRevision();
|
||||
$entity2->setOwner($user2);
|
||||
$entity2->save();
|
||||
$this->assertEquals($user2->id(), $entity->getOwner()->id(), 'User 2 found on entity 1');
|
||||
$this->assertEquals($user2->id(), $entity2->getOwner()->id(), 'User 2 found on entity 2');
|
||||
|
||||
$entity->addTranslation('de');
|
||||
$entity->save();
|
||||
$entity2->addTranslation('de');
|
||||
$entity2->save();
|
||||
|
||||
$expected_revision_ids = [
|
||||
4 => 2,
|
||||
3 => 1,
|
||||
2 => 2,
|
||||
1 => 1,
|
||||
];
|
||||
$revision_ids = $this->mulRev->getQuery()
|
||||
->allRevisions()
|
||||
->sort('revision_id', 'DESC')
|
||||
->execute();
|
||||
$this->assertEquals($expected_revision_ids, $revision_ids, 'Revision ids found');
|
||||
|
||||
$expected_non_rev_field_revision_ids = [
|
||||
3 => 1,
|
||||
1 => 1,
|
||||
];
|
||||
$non_rev_field_revision_ids = $this->mulRev->getQuery()
|
||||
->allRevisions()
|
||||
->condition('non_rev_field', 'Huron')
|
||||
->sort('revision_id', 'DESC')
|
||||
->execute();
|
||||
$this->assertEquals($expected_non_rev_field_revision_ids, $non_rev_field_revision_ids, 'Revision ids found');
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests non-revisionable fields on revisionable entities.
|
||||
*/
|
||||
public function testNonRevisionableField() {
|
||||
$user1 = $this->createUser();
|
||||
$user2 = $this->createUser();
|
||||
|
||||
// Create a test entity.
|
||||
$entity = EntityTestRev::create(array(
|
||||
'name' => $this->randomString(),
|
||||
'user_id' => $user1->id(),
|
||||
'non_rev_field' => 'Superior',
|
||||
));
|
||||
$entity->save();
|
||||
|
||||
// Create a test entity.
|
||||
$entity2 = EntityTestRev::create(array(
|
||||
'name' => $this->randomString(),
|
||||
'user_id' => $user1->id(),
|
||||
'non_rev_field' => 'Ontario',
|
||||
));
|
||||
$entity2->save();
|
||||
|
||||
$this->assertEquals('Superior', $entity->get('non_rev_field')->value, 'Superior found on entity 1');
|
||||
$this->assertEquals('Ontario', $entity2->get('non_rev_field')->value, 'Ontario found on entity 2');
|
||||
|
||||
$entity->setNewRevision();
|
||||
$entity->setOwner($user2);
|
||||
$entity->save();
|
||||
$entity2->setNewRevision();
|
||||
$entity2->setOwner($user2);
|
||||
$entity2->save();
|
||||
$this->assertEquals($user2->id(), $entity->getOwner()->id(), 'User 2 found on entity 1');
|
||||
$this->assertEquals($user2->id(), $entity2->getOwner()->id(), 'User 2 found on entity 2');
|
||||
|
||||
$expected_revision_ids = [
|
||||
4 => 2,
|
||||
3 => 1,
|
||||
2 => 2,
|
||||
1 => 1,
|
||||
];
|
||||
$revision_ids = $this->rev->getQuery()
|
||||
->allRevisions()
|
||||
->sort('revision_id', 'DESC')
|
||||
->execute();
|
||||
$this->assertEquals($expected_revision_ids, $revision_ids, 'Revision ids found');
|
||||
|
||||
$expected_non_rev_field_revision_ids = [
|
||||
3 => 1,
|
||||
1 => 1,
|
||||
];
|
||||
$non_rev_field_revision_ids = $this->rev->getQuery()
|
||||
->allRevisions()
|
||||
->condition('non_rev_field', 'Superior')
|
||||
->sort('revision_id', 'DESC')
|
||||
->execute();
|
||||
$this->assertEquals($expected_non_rev_field_revision_ids, $non_rev_field_revision_ids, 'Revision ids found');
|
||||
}
|
||||
|
||||
}
|
|
@ -344,7 +344,7 @@ class EntityDefinitionUpdateTest extends EntityKernelTestBase {
|
|||
$message = 'The new_bundle_field_shape column is not nullable.';
|
||||
$values = array(
|
||||
'bundle' => $entity->bundle(),
|
||||
'deleted'=> 0,
|
||||
'deleted' => 0,
|
||||
'entity_id' => $entity->id(),
|
||||
'revision_id' => $entity->id(),
|
||||
'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
|
||||
|
|
|
@ -3,12 +3,16 @@
|
|||
namespace Drupal\KernelTests\Core\Entity;
|
||||
|
||||
use Drupal\Core\Entity\EntityInterface;
|
||||
use Drupal\Core\Entity\TypedData\EntityDataDefinition;
|
||||
use Drupal\Core\Entity\TypedData\EntityDataDefinitionInterface;
|
||||
use Drupal\Core\Field\BaseFieldDefinition;
|
||||
use Drupal\Core\Field\FieldDefinitionInterface;
|
||||
use Drupal\Core\Field\FieldItemListInterface;
|
||||
use Drupal\Core\Field\FieldItemInterface;
|
||||
use Drupal\Core\Field\FieldItemListInterface;
|
||||
use Drupal\Core\TypedData\ComplexDataDefinitionInterface;
|
||||
use Drupal\Core\TypedData\ComplexDataInterface;
|
||||
use Drupal\Core\TypedData\DataDefinitionInterface;
|
||||
use Drupal\Core\TypedData\ListInterface;
|
||||
use Drupal\Core\TypedData\Type\StringInterface;
|
||||
use Drupal\Core\TypedData\TypedDataInterface;
|
||||
use Drupal\node\Entity\Node;
|
||||
|
@ -420,7 +424,7 @@ class EntityFieldTest extends EntityKernelTestBase {
|
|||
$this->assertEqual($value_definition->getDataType(), 'string');
|
||||
|
||||
// Test deriving metadata from references.
|
||||
$entity_definition = \Drupal\Core\Entity\TypedData\EntityDataDefinition::create($entity_type);
|
||||
$entity_definition = EntityDataDefinition::create($entity_type);
|
||||
$langcode_key = $this->entityManager->getDefinition($entity_type)->getKey('langcode');
|
||||
$reference_definition = $entity_definition->getPropertyDefinition($langcode_key)
|
||||
->getPropertyDefinition('language')
|
||||
|
@ -431,7 +435,7 @@ class EntityFieldTest extends EntityKernelTestBase {
|
|||
->getPropertyDefinition('entity')
|
||||
->getTargetDefinition();
|
||||
|
||||
$this->assertTrue($reference_definition instanceof \Drupal\Core\Entity\TypedData\EntityDataDefinitionInterface, 'Definition of the referenced user retrieved.');
|
||||
$this->assertTrue($reference_definition instanceof EntityDataDefinitionInterface, 'Definition of the referenced user retrieved.');
|
||||
$this->assertEqual($reference_definition->getEntityTypeId(), 'user', 'Referenced entity is of type "user".');
|
||||
|
||||
// Test propagating down.
|
||||
|
@ -583,12 +587,12 @@ class EntityFieldTest extends EntityKernelTestBase {
|
|||
|
||||
// Recurse until a certain depth is reached if possible.
|
||||
if ($depth < 7) {
|
||||
if ($wrapper instanceof \Drupal\Core\TypedData\ListInterface) {
|
||||
if ($wrapper instanceof ListInterface) {
|
||||
foreach ($wrapper as $item) {
|
||||
$this->getContainedStrings($item, $depth + 1, $strings);
|
||||
}
|
||||
}
|
||||
elseif ($wrapper instanceof \Drupal\Core\TypedData\ComplexDataInterface) {
|
||||
elseif ($wrapper instanceof ComplexDataInterface) {
|
||||
foreach ($wrapper as $property) {
|
||||
$this->getContainedStrings($property, $depth + 1, $strings);
|
||||
}
|
||||
|
|
|
@ -135,7 +135,7 @@ class EntityQueryAggregateTest extends EntityKernelTestBase {
|
|||
$function_expected['min'] = array(array('id_min' => 1));
|
||||
$function_expected['max'] = array(array('id_max' => 6));
|
||||
$function_expected['sum'] = array(array('id_sum' => 21));
|
||||
$function_expected['avg'] = array(array('id_avg' => (21.0/6.0)));
|
||||
$function_expected['avg'] = array(array('id_avg' => (21.0 / 6.0)));
|
||||
|
||||
// Apply a simple aggregation for different aggregation functions.
|
||||
foreach ($function_expected as $aggregation_function => $expected) {
|
||||
|
|
|
@ -535,7 +535,7 @@ class EntityQueryTest extends EntityKernelTestBase {
|
|||
|
||||
protected function assertBundleOrder($order) {
|
||||
// This loop is for bundle1 entities.
|
||||
for ($i = 1; $i <= 15; $i +=2) {
|
||||
for ($i = 1; $i <= 15; $i += 2) {
|
||||
$ok = TRUE;
|
||||
$index1 = array_search($i, $this->queryResults);
|
||||
$this->assertNotIdentical($index1, FALSE, "$i found at $index1.");
|
||||
|
|
|
@ -4,9 +4,9 @@ namespace Drupal\KernelTests\Core\Entity\EntityReferenceSelection;
|
|||
|
||||
use Drupal\Component\Utility\Html;
|
||||
use Drupal\field\Entity\FieldConfig;
|
||||
use Drupal\KernelTests\Core\Entity\EntityKernelTestBase;
|
||||
use Drupal\node\Entity\Node;
|
||||
use Drupal\node\Entity\NodeType;
|
||||
use Drupal\system\Tests\Entity\EntityUnitTestBase;
|
||||
use Drupal\field\Entity\FieldStorageConfig;
|
||||
|
||||
/**
|
||||
|
@ -14,7 +14,7 @@ use Drupal\field\Entity\FieldStorageConfig;
|
|||
*
|
||||
* @group entity_reference
|
||||
*/
|
||||
class EntityReferenceSelectionSortTest extends EntityUnitTestBase {
|
||||
class EntityReferenceSelectionSortTest extends EntityKernelTestBase {
|
||||
|
||||
/**
|
||||
* Modules to enable.
|
||||
|
|
|
@ -158,7 +158,7 @@ class EntityViewBuilderTest extends EntityKernelTestBase {
|
|||
// Test a view mode in default conditions: render caching is enabled for
|
||||
// the entity type and the view mode.
|
||||
$build = $this->container->get('entity.manager')->getViewBuilder('entity_test')->view($entity_test, 'full');
|
||||
$this->assertTrue(isset($build['#cache']) && array_keys($build['#cache']) == ['tags', 'contexts', 'max-age', 'keys', 'bin'] , 'A view mode with render cache enabled has the correct output (cache tags, keys, contexts, max-age and bin).');
|
||||
$this->assertTrue(isset($build['#cache']) && array_keys($build['#cache']) == ['tags', 'contexts', 'max-age', 'keys', 'bin'], 'A view mode with render cache enabled has the correct output (cache tags, keys, contexts, max-age and bin).');
|
||||
|
||||
// Test that a view mode can opt out of render caching.
|
||||
$build = $this->container->get('entity.manager')->getViewBuilder('entity_test')->view($entity_test, 'test');
|
||||
|
@ -185,7 +185,7 @@ class EntityViewBuilderTest extends EntityKernelTestBase {
|
|||
|
||||
// Create and build a test entity.
|
||||
$entity_test = $this->createTestEntity('entity_test');
|
||||
$view = $this->container->get('entity.manager')->getViewBuilder('entity_test')->view($entity_test, 'full');
|
||||
$view = $this->container->get('entity.manager')->getViewBuilder('entity_test')->view($entity_test, 'full');
|
||||
$renderer->renderRoot($view);
|
||||
|
||||
// Check that the weight is respected.
|
||||
|
|
|
@ -16,7 +16,9 @@ class AliasStorageTest extends KernelTestBase {
|
|||
*/
|
||||
public static $modules = ['system'];
|
||||
|
||||
/** @var \Drupal\Core\Path\AliasStorage */
|
||||
/**
|
||||
* @var \Drupal\Core\Path\AliasStorage
|
||||
*/
|
||||
protected $storage;
|
||||
|
||||
/**
|
||||
|
|
|
@ -16,10 +16,11 @@ use Drupal\Core\DependencyInjection\ServiceProviderInterface;
|
|||
use Drupal\Core\DrupalKernel;
|
||||
use Drupal\Core\Entity\Sql\SqlEntityStorageInterface;
|
||||
use Drupal\Core\Extension\ExtensionDiscovery;
|
||||
use Drupal\Core\Language\Language;
|
||||
use Drupal\Core\Site\Settings;
|
||||
use Drupal\simpletest\AssertContentTrait;
|
||||
use Drupal\simpletest\AssertHelperTrait;
|
||||
use Drupal\simpletest\RandomGeneratorTrait;
|
||||
use Drupal\Tests\RandomGeneratorTrait;
|
||||
use Drupal\simpletest\TestServiceProvider;
|
||||
use Symfony\Component\DependencyInjection\Reference;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
@ -136,10 +137,9 @@ abstract class KernelTestBase extends \PHPUnit_Framework_TestCase implements Ser
|
|||
/**
|
||||
* Modules to enable.
|
||||
*
|
||||
* Test classes extending this class, and any classes in the hierarchy up to
|
||||
* this class, may specify individual lists of modules to enable by setting
|
||||
* this property. The values of all properties in all classes in the class
|
||||
* hierarchy are merged.
|
||||
* The test runner will merge the $modules lists from this class, the class
|
||||
* it extends, and so on up the class hierarchy. It is not necessary to
|
||||
* include modules in your list that a parent class has already declared.
|
||||
*
|
||||
* @see \Drupal\Tests\KernelTestBase::enableModules()
|
||||
* @see \Drupal\Tests\KernelTestBase::bootKernel()
|
||||
|
@ -604,6 +604,9 @@ abstract class KernelTestBase extends \PHPUnit_Framework_TestCase implements Ser
|
|||
$container
|
||||
->setAlias('keyvalue', 'keyvalue.memory');
|
||||
|
||||
// Set the default language on the minimal container.
|
||||
$container->setParameter('language.default_values', Language::$defaultValues);
|
||||
|
||||
if ($this->strictConfigSchema) {
|
||||
$container
|
||||
->register('simpletest.config_schema_checker', 'Drupal\Core\Config\Testing\ConfigSchemaChecker')
|
||||
|
@ -1205,7 +1208,7 @@ abstract class KernelTestBase extends \PHPUnit_Framework_TestCase implements Ser
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function assertEquals($expected, $actual, $message = '', $delta = 0.0, $maxDepth = 10, $canonicalize = false, $ignoreCase = false) {
|
||||
public static function assertEquals($expected, $actual, $message = '', $delta = 0.0, $maxDepth = 10, $canonicalize = FALSE, $ignoreCase = FALSE) {
|
||||
$expected = static::castSafeStrings($expected);
|
||||
$actual = static::castSafeStrings($actual);
|
||||
parent::assertEquals($expected, $actual, $message, $delta, $maxDepth, $canonicalize, $ignoreCase);
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\simpletest\Tests;
|
||||
|
||||
use Drupal\KernelTests\KernelTestBase;
|
||||
|
||||
/**
|
||||
* This test should not load since it requires a module that is not found.
|
||||
*
|
||||
* @group simpletest
|
||||
* @dependencies simpletest_missing_module
|
||||
*/
|
||||
class MissingDependentModuleUnitTest extends KernelTestBase {
|
||||
|
||||
/**
|
||||
* Ensure that this test will not be loaded despite its dependency.
|
||||
*/
|
||||
function testFail() {
|
||||
$this->fail('Running test with missing required module.');
|
||||
}
|
||||
}
|
Reference in a new issue