NullNormalizer example


  protected $interface = 'Drupal\Core\TypedData\TypedDataInterface';

  /** * {@inheritdoc} */
  protected function setUp(): void {
    parent::setUp();

    $this->normalizer = new NullNormalizer($this->interface);
  }

  /** * @covers ::__construct * @covers ::supportsNormalization */
  public function testSupportsNormalization() {
    $mock = $this->createMock('Drupal\Core\TypedData\TypedDataInterface');
    $this->assertTrue($this->normalizer->supportsNormalization($mock));
    // Also test that an object not implementing TypedDataInterface fails.     $this->assertFalse($this->normalizer->supportsNormalization(new \stdClass()));
  }
Home | Imprint | This part of the site doesn't use cookies.