function ComponentMetadataTest::testMetadataEnforceSchema
Same name in this branch
- 11.x core/modules/sdc/tests/src/Unit/ComponentMetadataTest.php \Drupal\Tests\sdc\Unit\ComponentMetadataTest::testMetadataEnforceSchema()
Same name in other branches
- 10 core/modules/sdc/tests/src/Unit/ComponentMetadataTest.php \Drupal\Tests\sdc\Unit\ComponentMetadataTest::testMetadataEnforceSchema()
- 10 core/tests/Drupal/Tests/Core/Theme/Component/ComponentMetadataTest.php \Drupal\Tests\Core\Theme\Component\ComponentMetadataTest::testMetadataEnforceSchema()
Tests the correct checks when enforcing schemas or not.
@dataProvider dataProviderMetadata
File
-
core/
tests/ Drupal/ Tests/ Core/ Theme/ Component/ ComponentMetadataTest.php, line 37
Class
- ComponentMetadataTest
- Unit tests for the component metadata class.
Namespace
Drupal\Tests\Core\Theme\ComponentCode
public function testMetadataEnforceSchema(array $metadata_info, array $expectations, bool $missing_schema) : void {
if ($missing_schema) {
$this->expectException(InvalidComponentException::class);
$this->expectExceptionMessage('The component "' . $metadata_info['id'] . '" does not provide schema information. Schema definitions are mandatory for components declared in modules. For components declared in themes, schema definitions are only mandatory if the "enforce_prop_schemas" key is set to "true" in the theme info file.');
new ComponentMetadata($metadata_info, 'foo/', TRUE);
}
else {
new ComponentMetadata($metadata_info, 'foo/', TRUE);
$this->expectNotToPerformAssertions();
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.