You are here

public function FactoryMapperTest::testYamlHasAllFactories in Hook Event Dispatcher 3.x

Same name and namespace in other branches
  1. 8.2 modules/preprocess_event_dispatcher/tests/src/Unit/FactoryMapperTest.php \Drupal\Tests\preprocess_event_dispatcher\Unit\FactoryMapperTest::testYamlHasAllFactories()

Test if all factories are in the YAML file.

File

modules/preprocess_event_dispatcher/tests/src/Unit/FactoryMapperTest.php, line 38

Class

FactoryMapperTest
Class FactoryMapperTest.

Namespace

Drupal\Tests\preprocess_event_dispatcher\Unit

Code

public function testYamlHasAllFactories() : void {
  $factoriesYaml = YamlDefinitionsLoader::getInstance()
    ->getFactories();
  $classNames = $this
    ->getFactoryClassNamesFromFilesystem();
  self::assertCount(count($factoriesYaml), $classNames);
  foreach ($factoriesYaml as $entry) {
    self::assertContains($entry['class'], $classNames);
  }
}