Commit 0bfec158 authored by phenaproxima's avatar phenaproxima

Issue #3109693 by phenaproxima, katherined, Wim Leers, Berdir, oknate: Fix...

Issue #3109693 by phenaproxima, katherined, Wim Leers, Berdir, oknate: Fix tests on Drupal 9 and drop support for 8.7
parent beadf308
......@@ -9,7 +9,7 @@
},
"license": "GPL-2.0+",
"require": {
"drupal/core": "^8.7.7 || ^9",
"drupal/core": "^8.8 || ^9",
"drupal/embed": "^1.3"
},
"require-dev": {
......
name: Entity Embed
type: module
description: 'Allows entities to be embedded using a text editor.'
core_version_requirement: ^8.7.7 || ^9
core_version_requirement: ^8.8 || ^9
package: Filters
dependencies:
- drupal:editor
- embed:embed
- drupal:filter
- drupal:system (>=8.4.0)
- drupal:system
test_dependencies:
- entity_browser:entity_browser
......@@ -8,6 +8,7 @@ use Drupal\Core\Entity\ContentEntityInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Field\FormatterPluginManager;
use Drupal\Core\Language\LanguageManagerInterface;
use Drupal\Core\Security\TrustedCallbackInterface;
use Drupal\Core\TypedData\TypedDataManager;
use Drupal\entity_embed\EntityEmbedDisplay\FieldFormatterEntityEmbedDisplayBase;
use Symfony\Component\DependencyInjection\ContainerInterface;
......@@ -15,10 +16,6 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Entity Embed Display reusing entity reference field formatters.
*
* @todo Implement \Drupal\Core\Security\TrustedCallbackInterface on this class
* when Drupal 8.8 is the minimum supported version, and before Drupal 9 is
* released.
*
* @see \Drupal\entity_embed\EntityEmbedDisplay\EntityEmbedDisplayInterface
*
* @EntityEmbedDisplay(
......@@ -29,7 +26,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
* supports_image_alt_and_title = TRUE
* )
*/
class EntityReferenceFieldFormatter extends FieldFormatterEntityEmbedDisplayBase {
class EntityReferenceFieldFormatter extends FieldFormatterEntityEmbedDisplayBase implements TrustedCallbackInterface {
/**
* The configuration factory.
......@@ -80,6 +77,16 @@ class EntityReferenceFieldFormatter extends FieldFormatterEntityEmbedDisplayBase
);
}
/**
* {@inheritdoc}
*/
public static function trustedCallbacks() {
return [
'disableContextualLinks',
'disableQuickEdit',
];
}
/**
* {@inheritdoc}
*/
......
name: 'Entity Embed test'
type: module
description: 'Support module for the Entity Embed module tests.'
core: 8.x
package: Testing
dependencies:
- drupal:file
......
name: 'Entity Embed Translation test'
type: module
description: 'Aids in testing translation within entity embed'
core: 8.x
package: Testing
dependencies:
- drupal:content_translation
......
......@@ -16,7 +16,7 @@ class EntityEmbedTwigTest extends EntityEmbedTestBase {
*/
protected function setUp() {
parent::setUp();
\Drupal::service('theme_handler')->install(['test_theme']);
\Drupal::service('theme_installer')->install(['test_theme']);
}
/**
......
......@@ -16,7 +16,7 @@ class EntityEmbedUpdateHookTest extends UpdatePathTestBase {
*/
protected function setDatabaseDumpFiles() {
$this->databaseDumpFiles = [
DRUPAL_ROOT . '/core/modules/system/tests/fixtures/update/drupal-8.bare.standard.php.gz',
$this->getDrupalRoot() . '/core/modules/system/tests/fixtures/update/drupal-8.8.0.bare.standard.php.gz',
__DIR__ . '/../../fixtures/update/entity_embed.update-hook-test.php',
];
}
......
......@@ -129,7 +129,7 @@ class ContentTranslationTest extends EntityEmbedTestBase {
$this->drupalGet('node/' . $host->id() . '/edit');
$this->waitForEditor();
$this->pressEditorButton('test_node');
$this->assertTrue($this->assertSession()->waitForElementVisible('css', '#entity-embed-dialog-form'));
$this->assertNotEmpty($this->assertSession()->waitForElementVisible('css', '#entity-embed-dialog-form'));
// Assert autocomplete suggestions are in host entity language (en).
$suggestions = $this->getAutocompleteSuggestions('clar');
......@@ -188,7 +188,7 @@ class ContentTranslationTest extends EntityEmbedTestBase {
$this->drupalGet('/fr/node/' . $host->id() . '/edit');
$this->waitForEditor();
$this->pressEditorButton('test_node');
$this->assertTrue($this->assertSession()->waitForElementVisible('css', '#entity-embed-dialog-form'));
$this->assertNotEmpty($this->assertSession()->waitForElementVisible('css', '#entity-embed-dialog-form'));
// Assert autocomplete suggestions are in host entity language (fr).
$suggestions = $this->getAutocompleteSuggestions('super');
......
......@@ -727,13 +727,13 @@ class MediaImageTest extends EntityEmbedTestBase {
$element = $this->assertSession()->elementExists('css', '[data-entity-embed-test-active-theme]');
$this->assertSame('stable', $element->getAttribute('data-entity-embed-test-active-theme'));
// Assert that the first preview request transferred >2 KB over the wire.
// Assert that the first preview request transferred data over the wire.
// Then toggle source mode on and off. This causes the CKEditor widget to be
// destroyed and then reconstructed. Assert that during this reconstruction,
// a second request is sent. This second request should have transferred 0
// bytes: the browser should have cached the response, thus resulting in a
// much better user experience.
$this->assertGreaterThan(2048, $this->getLastPreviewRequestTransferSize());
$this->assertGreaterThan(0, $this->getLastPreviewRequestTransferSize());
$this->pressEditorButton('source');
$this->assertSession()->waitForElement('css', 'textarea.cke_source');
$this->pressEditorButton('source');
......
Markdown is supported
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