validateDefinition example


  private function isValidDefinition(array $definition): bool {
    return $this->componentValidator->validateDefinition(
      $definition,
      $this->shouldEnforceSchemas($definition)
    );
  }

  /** * Get the list of directories to scan. * * @return string[] * The directories. */
  
/** * Tests that valid component definitions don't cause errors. * * @dataProvider dataProviderValidateDefinitionValid * * @throws \Drupal\sdc\Exception\InvalidComponentException */
  public function testValidateDefinitionValid(array $definition): void {
    $component_validator = new ComponentValidator();
    $component_validator->setValidator();
    $this->assertTrue(
      $component_validator->validateDefinition($definition, TRUE),
      'The invalid component definition did not throw an error.'
    );
  }

  /** * Data provider with valid component definitions. * * @return array * The data. */
  public static function dataProviderValidateDefinitionValid(): array {
    
Home | Imprint | This part of the site doesn't use cookies.