class TestNormalizerBase

Same name and namespace in other branches
  1. 9 core/modules/serialization/tests/src/Unit/Normalizer/NormalizerBaseTest.php \Drupal\Tests\serialization\Unit\Normalizer\TestNormalizerBase
  2. 8.9.x core/modules/serialization/tests/src/Unit/Normalizer/NormalizerBaseTest.php \Drupal\Tests\serialization\Unit\Normalizer\TestNormalizerBase
  3. 11.x core/modules/serialization/tests/src/Unit/Normalizer/NormalizerBaseTest.php \Drupal\Tests\serialization\Unit\Normalizer\TestNormalizerBase

Test class for NormalizerBase.

Hierarchy

Expanded class hierarchy of TestNormalizerBase

File

core/modules/serialization/tests/src/Unit/Normalizer/NormalizerBaseTest.php, line 66

Namespace

Drupal\Tests\serialization\Unit\Normalizer
View source
abstract class TestNormalizerBase extends NormalizerBase {
    
    /**
     * The interface or class that this Normalizer supports.
     *
     * @var string[]
     */
    protected array $supportedTypes = [
        '*' => FALSE,
    ];
    
    /**
     * Sets the supported types.
     *
     * @param string $supported_types
     *   The class name to set.
     */
    public function setSupportedTypes($supported_types) : void {
        $this->supportedTypes = [
            $supported_types => FALSE,
        ];
    }
    
    /**
     * {@inheritdoc}
     */
    public function getSupportedTypes(?string $format) : array {
        return $this->supportedTypes;
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title Overrides
CacheableNormalizerInterface::SERIALIZATION_CONTEXT_CACHEABILITY constant Name of key for bubbling cacheability metadata via serialization context.
NormalizerBase::$format protected property List of formats which supports (de-)normalization. 1
NormalizerBase::addCacheableDependency protected function Adds cacheability if applicable.
NormalizerBase::checkFormat protected function Checks if the provided format is supported by this normalizer. 1
NormalizerBase::hasCacheableSupportsMethod public function 16
NormalizerBase::supportsDenormalization public function Implements \Symfony\Component\Serializer\Normalizer\DenormalizerInterface::supportsDenormalization() 1
NormalizerBase::supportsNormalization public function 1
TestNormalizerBase::$supportedTypes protected property The interface or class that this Normalizer supports.
TestNormalizerBase::getSupportedTypes public function Overrides NormalizerBase::getSupportedTypes
TestNormalizerBase::setSupportedTypes public function Sets the supported types.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.