class MarkupNormalizerTest
Tests Drupal\serialization\Normalizer\MarkupNormalizer.
Attributes
#[CoversClass(MarkupNormalizer::class)]
#[Group('serialization')]
Hierarchy
- class \Drupal\Tests\UnitTestCase uses \Drupal\Tests\PhpUnitCompatibilityTrait, \Prophecy\PhpUnit\ProphecyTrait, \Drupal\TestTools\Extension\DeprecationBridge\ExpectDeprecationTrait, \Drupal\Tests\RandomGeneratorTrait extends \PHPUnit\Framework\TestCase
- class \Drupal\Tests\serialization\Unit\Normalizer\MarkupNormalizerTest uses \Drupal\Tests\serialization\Traits\JsonSchemaTestTrait extends \Drupal\Tests\UnitTestCase
Expanded class hierarchy of MarkupNormalizerTest
File
-
core/
modules/ serialization/ tests/ src/ Unit/ Normalizer/ MarkupNormalizerTest.php, line 18
Namespace
Drupal\Tests\serialization\Unit\NormalizerView source
final class MarkupNormalizerTest extends UnitTestCase {
use JsonSchemaTestTrait;
/**
* The TypedDataNormalizer instance.
*
* @var \Drupal\serialization\Normalizer\TypedDataNormalizer
*/
protected $normalizer;
/**
* {@inheritdoc}
*/
protected function setUp() : void {
parent::setUp();
$this->normalizer = new MarkupNormalizer();
}
/**
* Test the normalizer properly delegates schema discovery to its subject.
*/
public function testDelegatedSchemaDiscovery() : void {
$schema = $this->normalizer
->getNormalizationSchema(new Attribute([
'data-test' => 'testing',
]));
$this->assertEquals('Rendered HTML element attributes', $schema['description']);
}
/**
* {@inheritdoc}
*/
public static function jsonSchemaDataProvider() : array {
return [
'markup' => [
Markup::create('Generic Markup'),
],
'attribute' => [
new Attribute([
'data-test' => 'testing',
]),
],
];
}
}
Members
| Title Sort descending | Modifiers | Object type | Summary | Overriden Title | Overrides |
|---|---|---|---|---|---|
| ExpectDeprecationTrait::expectDeprecation | public | function | Adds an expected deprecation. | ||
| ExpectDeprecationTrait::setUpErrorHandler | public | function | Sets up the test error handler. | ||
| ExpectDeprecationTrait::tearDownErrorHandler | public | function | Tears down the test error handler. | ||
| JsonSchemaTestTrait::doCheckSchemaAgainstMetaSchema | protected | function | Check a schema is valid against the meta-schema. | ||
| JsonSchemaTestTrait::doProphesize | public | function | Method to make prophecy public for use in data provider closures. | ||
| JsonSchemaTestTrait::doTestJsonSchemaIsValid | public | function | Validate the normalizer's JSON schema. | ||
| JsonSchemaTestTrait::getJsonSchemaTestNormalizationFormat | protected | function | Format that should be used when performing test normalizations. | 1 | |
| JsonSchemaTestTrait::getNormalizationForValue | protected | function | Get the normalization for a value. | ||
| JsonSchemaTestTrait::getNormalizer | protected | function | Helper method to retrieve the normalizer. | 1 | |
| JsonSchemaTestTrait::getValidator | protected | function | Get the JSON Schema Validator. | 1 | |
| JsonSchemaTestTrait::supportedTypesDataProvider | public static | function | |||
| JsonSchemaTestTrait::testNormalizedValuesAgainstJsonSchema | public | function | Test normalized values against the JSON schema. | ||
| JsonSchemaTestTrait::testSupportedTypesSchemaIsValid | public | function | Test that a valid schema is returned for the explicitly supported types. | ||
| MarkupNormalizerTest::$normalizer | protected | property | The TypedDataNormalizer instance. | ||
| MarkupNormalizerTest::jsonSchemaDataProvider | public static | function | Data provider for ::testNormalizedValuesAgainstJsonSchema. | Overrides JsonSchemaTestTrait::jsonSchemaDataProvider | |
| MarkupNormalizerTest::setUp | protected | function | Overrides UnitTestCase::setUp | ||
| MarkupNormalizerTest::testDelegatedSchemaDiscovery | public | function | Test the normalizer properly delegates schema discovery to its subject. | ||
| RandomGeneratorTrait::getRandomGenerator | protected | function | Gets the random generator for the utility methods. | ||
| RandomGeneratorTrait::randomMachineName | protected | function | Generates a unique random string containing letters and numbers. | ||
| RandomGeneratorTrait::randomObject | public | function | Generates a random PHP object. | ||
| RandomGeneratorTrait::randomString | public | function | Generates a pseudo-random string of ASCII characters of codes 32 to 126. | ||
| UnitTestCase::$root | protected | property | The app root. | ||
| UnitTestCase::getClassResolverStub | protected | function | Returns a stub class resolver. | ||
| UnitTestCase::getConfigFactoryStub | public | function | Returns a stub config factory that behaves according to the passed array. | ||
| UnitTestCase::getContainerWithCacheTagsInvalidator | protected | function | Sets up a container with a cache tags invalidator. | ||
| UnitTestCase::getStringTranslationStub | public | function | Returns a stub translation manager that just returns the passed string. | ||
| UnitTestCase::setDebugDumpHandler | public static | function | Registers the dumper CLI handler when the DebugDump extension is enabled. | ||
| UnitTestCase::setupMockIterator | protected | function | Set up a traversable class mock to return specific items when iterated. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.