protected function CKEditorIntegrationTest::getDrupalMediaFromSource in Drupal 9
Same name and namespace in other branches
- 8 core/modules/media/tests/src/FunctionalJavascript/CKEditorIntegrationTest.php \Drupal\Tests\media\FunctionalJavascript\CKEditorIntegrationTest::getDrupalMediaFromSource()
 
Parses the <drupal-media> element from CKEditor's "source" view.
Assumes CKEditor is in source mode.
Return value
\DOMNode|null The drupal-media element or NULL if it can't be found.
3 calls to CKEditorIntegrationTest::getDrupalMediaFromSource()
- CKEditorIntegrationTest::assertSourceAttributeSame in core/
modules/ media/ tests/ src/ FunctionalJavascript/ CKEditorIntegrationTest.php  - Verifies value of an attribute on the downcast <drupal-media> element.
 - CKEditorIntegrationTest::testAlignment in core/
modules/ media/ tests/ src/ FunctionalJavascript/ CKEditorIntegrationTest.php  - Tests alignment integration.
 - CKEditorIntegrationTest::testViewMode in core/
modules/ media/ tests/ src/ FunctionalJavascript/ CKEditorIntegrationTest.php  - Tests the EditorMediaDialog can set the data-view-mode attribute.
 
File
- core/
modules/ media/ tests/ src/ FunctionalJavascript/ CKEditorIntegrationTest.php, line 1577  
Class
- CKEditorIntegrationTest
 - @coversDefaultClass \Drupal\media\Plugin\CKEditorPlugin\DrupalMedia @group media
 
Namespace
Drupal\Tests\media\FunctionalJavascriptCode
protected function getDrupalMediaFromSource() {
  $value = $this
    ->assertSession()
    ->elementExists('css', 'textarea.cke_source')
    ->getValue();
  $dom = Html::load($value);
  $xpath = new \DOMXPath($dom);
  $list = $xpath
    ->query('//drupal-media');
  return count($list) > 0 ? $list[0] : NULL;
}