function JsonSchemaTestTrait::doTestJsonSchemaIsValid
Validate the normalizer's JSON schema.
Parameters
mixed $type: Object/type being normalized.
bool $accept_no_schema_type: Whether to accept a schema with no meaningful type.
Return value
array Schema, so later tests can avoid retrieving it again.
2 calls to JsonSchemaTestTrait::doTestJsonSchemaIsValid()
- JsonSchemaTestTrait::testNormalizedValuesAgainstJsonSchema in core/
modules/ serialization/ tests/ src/ Traits/ JsonSchemaTestTrait.php - Test normalized values against the JSON schema.
- JsonSchemaTestTrait::testSupportedTypesSchemaIsValid in core/
modules/ serialization/ tests/ src/ Traits/ JsonSchemaTestTrait.php - Test that a valid schema is returned for the explicitly supported types.
File
-
core/
modules/ serialization/ tests/ src/ Traits/ JsonSchemaTestTrait.php, line 95
Class
- JsonSchemaTestTrait
- Trait for testing JSON Schema validity and fit to sample data.
Namespace
Drupal\Tests\serialization\TraitsCode
public function doTestJsonSchemaIsValid(mixed $type, bool $accept_no_schema_type = FALSE) : array {
$defined_schema = $this->getNormalizer()
->normalize($type, 'json_schema');
$this->doCheckSchemaAgainstMetaSchema($defined_schema, $accept_no_schema_type);
return $defined_schema;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.