function ComponentMetadataTest::testMetadataEnforceSchema
Same name in this branch
- 10 core/tests/Drupal/Tests/Core/Theme/Component/ComponentMetadataTest.php \Drupal\Tests\Core\Theme\Component\ComponentMetadataTest::testMetadataEnforceSchema()
Same name in other branches
- 11.x core/modules/sdc/tests/src/Unit/ComponentMetadataTest.php \Drupal\Tests\sdc\Unit\ComponentMetadataTest::testMetadataEnforceSchema()
- 11.x 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/
modules/ sdc/ tests/ src/ Unit/ ComponentMetadataTest.php, line 39
Class
- ComponentMetadataTest
- Unit tests for the component metadata class.
Namespace
Drupal\Tests\sdc\UnitCode
public function testMetadataEnforceSchema(array $metadata_info, array $expectations, bool $missing_schema) {
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.