function CKEditorIntegrationTest::assertSourceAttributeSame

Verifies value of an attribute on the downcast <drupal-media> element.

Assumes CKEditor is in source mode.

Parameters

string $attribute: The attribute to check.

mixed $value: Either a string value or if NULL, asserts that <drupal-media> element doesn't have the attribute.

2 calls to CKEditorIntegrationTest::assertSourceAttributeSame()
CKEditorIntegrationTest::testAlignment in core/modules/media/tests/src/FunctionalJavascript/CKEditorIntegrationTest.php
Tests alignment integration.
CKEditorIntegrationTest::testAlt in core/modules/media/tests/src/FunctionalJavascript/CKEditorIntegrationTest.php
Tests the EditorMediaDialog can set the alt attribute.

File

core/modules/media/tests/src/FunctionalJavascript/CKEditorIntegrationTest.php, line 1381

Class

CKEditorIntegrationTest
@coversDefaultClass \Drupal\media\Plugin\CKEditorPlugin\DrupalMedia @group media

Namespace

Drupal\Tests\media\FunctionalJavascript

Code

protected function assertSourceAttributeSame($attribute, $value) {
    $this->assertNotEmpty($drupal_media = $this->getDrupalMediaFromSource());
    if ($value === NULL) {
        $this->assertFalse($drupal_media->hasAttribute($attribute));
    }
    else {
        $this->assertSame($value, $drupal_media->getAttribute($attribute));
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.