function CKEditor5Test::testPathsToFormNames

Same name and namespace in other branches
  1. 9 core/modules/ckeditor5/tests/src/Unit/CKEditor5Test.php \Drupal\Tests\ckeditor5\Unit\CKEditor5Test::testPathsToFormNames()
  2. 11.x core/modules/ckeditor5/tests/src/Unit/CKEditor5Test.php \Drupal\Tests\ckeditor5\Unit\CKEditor5Test::testPathsToFormNames()

@covers \Drupal\ckeditor5\Plugin\Editor\CKEditor5::mapViolationPropertyPathsToFormNames
@dataProvider providerPathsToFormNames

File

core/modules/ckeditor5/tests/src/Unit/CKEditor5Test.php, line 46

Class

CKEditor5Test
@coversDefaultClass \Drupal\ckeditor5\Plugin\Editor\CKEditor5[[api-linebreak]] @group ckeditor5 @internal

Namespace

Drupal\Tests\ckeditor5\Unit

Code

public function testPathsToFormNames(string $property_path, string $expected_form_item_name, bool $expect_exception = FALSE) : void {
  $mapMethod = self::getMethod(CKEditor5::class, 'mapViolationPropertyPathsToFormNames');
  if ($expect_exception) {
    $this->expectExceptionMessage('assert($shifted === \'settings\')');
  }
  $form_item_name = $mapMethod->invokeArgs(NULL, [
    $property_path,
    static::SIMULATED_FORM_STRUCTURE,
  ]);
  if (!$expect_exception) {
    $this->assertSame($expected_form_item_name, $form_item_name);
  }
}

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