Update to Drupal 8.2.0. For more information, see https://www.drupal.org/project/drupal/releases/8.2.0
This commit is contained in:
parent
2f563ab520
commit
f1c8716f57
1732 changed files with 52334 additions and 11780 deletions
|
@ -76,20 +76,23 @@ class EditorFileReferenceFilterTest extends KernelTestBase {
|
|||
|
||||
$this->pass('One data-entity-uuid attribute.');
|
||||
$input = '<img src="llama.jpg" data-entity-type="file" data-entity-uuid="' . $uuid . '" />';
|
||||
$expected_output = '<img src="/' . $this->siteDirectory . '/files/llama.jpg" data-entity-type="file" data-entity-uuid="' . $uuid . '" />';
|
||||
$output = $test($input);
|
||||
$this->assertIdentical($input, $output->getProcessedText());
|
||||
$this->assertIdentical($expected_output, $output->getProcessedText());
|
||||
$this->assertEqual($cache_tag, $output->getCacheTags());
|
||||
|
||||
$this->pass('One data-entity-uuid attribute with odd capitalization.');
|
||||
$input = '<img src="llama.jpg" data-entity-type="file" DATA-entity-UUID = "' . $uuid . '" />';
|
||||
$expected_output = '<img src="/' . $this->siteDirectory . '/files/llama.jpg" data-entity-type="file" data-entity-uuid="' . $uuid . '" />';
|
||||
$output = $test($input);
|
||||
$this->assertIdentical($input, $output->getProcessedText());
|
||||
$this->assertIdentical($expected_output, $output->getProcessedText());
|
||||
$this->assertEqual($cache_tag, $output->getCacheTags());
|
||||
|
||||
$this->pass('One data-entity-uuid attribute on a non-image tag.');
|
||||
$input = '<video src="llama.jpg" data-entity-type="file" data-entity-uuid="' . $uuid . '" />';
|
||||
$expected_output = '<video src="/' . $this->siteDirectory . '/files/llama.jpg" data-entity-type="file" data-entity-uuid="' . $uuid . '"></video>';
|
||||
$output = $test($input);
|
||||
$this->assertIdentical($input, $output->getProcessedText());
|
||||
$this->assertIdentical($expected_output, $output->getProcessedText());
|
||||
$this->assertEqual($cache_tag, $output->getCacheTags());
|
||||
|
||||
$this->pass('One data-entity-uuid attribute with an invalid value.');
|
||||
|
@ -101,15 +104,19 @@ class EditorFileReferenceFilterTest extends KernelTestBase {
|
|||
$this->pass('Two different data-entity-uuid attributes.');
|
||||
$input = '<img src="llama.jpg" data-entity-type="file" data-entity-uuid="' . $uuid . '" />';
|
||||
$input .= '<img src="alpaca.jpg" data-entity-type="file" data-entity-uuid="' . $uuid_2 . '" />';
|
||||
$expected_output = '<img src="/' . $this->siteDirectory . '/files/llama.jpg" data-entity-type="file" data-entity-uuid="' . $uuid . '" />';
|
||||
$expected_output .= '<img src="/' . $this->siteDirectory . '/files/alpaca.jpg" data-entity-type="file" data-entity-uuid="' . $uuid_2 . '" />';
|
||||
$output = $test($input);
|
||||
$this->assertIdentical($input, $output->getProcessedText());
|
||||
$this->assertIdentical($expected_output, $output->getProcessedText());
|
||||
$this->assertEqual(Cache::mergeTags($cache_tag, $cache_tag_2), $output->getCacheTags());
|
||||
|
||||
$this->pass('Two identical data-entity-uuid attributes.');
|
||||
$input = '<img src="llama.jpg" data-entity-type="file" data-entity-uuid="' . $uuid . '" />';
|
||||
$input .= '<img src="llama.jpg" data-entity-type="file" data-entity-uuid="' . $uuid . '" />';
|
||||
$expected_output = '<img src="/' . $this->siteDirectory . '/files/llama.jpg" data-entity-type="file" data-entity-uuid="' . $uuid . '" />';
|
||||
$expected_output .= '<img src="/' . $this->siteDirectory . '/files/llama.jpg" data-entity-type="file" data-entity-uuid="' . $uuid . '" />';
|
||||
$output = $test($input);
|
||||
$this->assertIdentical($input, $output->getProcessedText());
|
||||
$this->assertIdentical($expected_output, $output->getProcessedText());
|
||||
$this->assertEqual($cache_tag, $output->getCacheTags());
|
||||
}
|
||||
|
||||
|
|
|
@ -17,11 +17,11 @@ use Drupal\node\Entity\NodeType;
|
|||
class EditorImageDialogTest extends EntityKernelTestBase {
|
||||
|
||||
/**
|
||||
* Filter format for testing.
|
||||
* Text editor config entity for testing.
|
||||
*
|
||||
* @var \Drupal\filter\FilterFormatInterface
|
||||
* @var \Drupal\editor\EditorInterface
|
||||
*/
|
||||
protected $format;
|
||||
protected $editor;
|
||||
|
||||
/**
|
||||
* Modules to enable.
|
||||
|
@ -42,7 +42,7 @@ class EditorImageDialogTest extends EntityKernelTestBase {
|
|||
$this->installConfig(['node']);
|
||||
|
||||
// Add text formats.
|
||||
$this->format = FilterFormat::create([
|
||||
$format = FilterFormat::create([
|
||||
'format' => 'filtered_html',
|
||||
'name' => 'Filtered HTML',
|
||||
'weight' => 0,
|
||||
|
@ -51,7 +51,7 @@ class EditorImageDialogTest extends EntityKernelTestBase {
|
|||
'filter_caption' => ['status' => TRUE],
|
||||
],
|
||||
]);
|
||||
$this->format->save();
|
||||
$format->save();
|
||||
|
||||
// Set up text editor.
|
||||
$editor = Editor::create([
|
||||
|
@ -65,6 +65,7 @@ class EditorImageDialogTest extends EntityKernelTestBase {
|
|||
],
|
||||
]);
|
||||
$editor->save();
|
||||
$this->editor = $editor;
|
||||
|
||||
// Create a node type for testing.
|
||||
$type = NodeType::create(['type' => 'page', 'name' => 'page']);
|
||||
|
@ -104,7 +105,7 @@ class EditorImageDialogTest extends EntityKernelTestBase {
|
|||
$form_state = (new FormState())
|
||||
->setRequestMethod('POST')
|
||||
->setUserInput($input)
|
||||
->addBuildInfo('args', [$this->format]);
|
||||
->addBuildInfo('args', [$this->editor]);
|
||||
|
||||
$form_builder = $this->container->get('form_builder');
|
||||
$form_object = new EditorImageDialog(\Drupal::entityManager()->getStorage('file'));
|
||||
|
|
|
@ -121,7 +121,9 @@ class QuickEditIntegrationTest extends QuickEditTestBase {
|
|||
* Returns the selected in-place editor.
|
||||
*/
|
||||
protected function getSelectedEditor($entity_id, $field_name, $view_mode = 'default') {
|
||||
$entity = entity_load('entity_test', $entity_id, TRUE);
|
||||
$storage = $this->container->get('entity_type.manager')->getStorage('entity_test');
|
||||
$storage->resetCache([$entity_id]);
|
||||
$entity = $storage->load($entity_id);
|
||||
$items = $entity->get($field_name);
|
||||
$options = entity_get_display('entity_test', 'entity_test', $view_mode)->getComponent($field_name);
|
||||
return $this->editorSelector->getEditor($options['type'], $items);
|
||||
|
@ -172,7 +174,7 @@ class QuickEditIntegrationTest extends QuickEditTestBase {
|
|||
$entity->{$this->fieldName}->value = 'Test';
|
||||
$entity->{$this->fieldName}->format = 'full_html';
|
||||
$entity->save();
|
||||
$entity = entity_load('entity_test', $entity->id());
|
||||
$entity = EntityTest::load($entity->id());
|
||||
|
||||
// Verify metadata.
|
||||
$items = $entity->get($this->fieldName);
|
||||
|
@ -209,7 +211,7 @@ class QuickEditIntegrationTest extends QuickEditTestBase {
|
|||
$entity->{$this->fieldName}->value = 'Test';
|
||||
$entity->{$this->fieldName}->format = 'full_html';
|
||||
$entity->save();
|
||||
$entity = entity_load('entity_test', $entity->id());
|
||||
$entity = EntityTest::load($entity->id());
|
||||
|
||||
// Verify AJAX response.
|
||||
$controller = new EditorController();
|
||||
|
|
Reference in a new issue