You are here

public function ModeManagerTest::testGetDefinitions in The CodeMirror Editor 8

Test callback.

File

tests/src/Kernel/ModeManagerTest.php, line 30

Class

ModeManagerTest
A test for plugin.manager.codemirror_mode service.

Namespace

Drupal\Tests\codemirror_editor\Kernel

Code

public function testGetDefinitions() {
  $manager = \Drupal::service('plugin.manager.codemirror_mode');
  $definitions = $manager
    ->getDefinitions();
  self::assertCount(12, $definitions);
  $expected_modes = [
    'clike',
    'css',
    'htmlmixed',
    'javascript',
    'markdown',
    'php',
    'python',
    'ruby',
    'sql',
    'twig',
    'xml',
    'yaml',
  ];
  self::assertEquals($expected_modes, array_keys($definitions));

  // @se codemirror_editor_test_codemirror_mode_info_alter()
  self::assertEquals([
    'codemirror_editor_test',
  ], $definitions['php']['usage']);
}