This will be the first of a few, we have integration tests for serializer classes, but no actual unit tests yet. There should be a lot of stuff we can test. So let's start with the Drupal\serialization\Normalizer\TypedDataNormalizer class.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dawehner’s picture

  1. +++ b/core/modules/serialization/tests/Drupal/serialization/Tests/Normalizer/TypedDataNormalizerTest.php
    @@ -0,0 +1,65 @@
    +/**
    + * Tests the TypedDataNormalizer class.
    + *
    + * @see \Drupal\serialization\Normalizer\TypedDataNormalizer
    + */
    +class TypedDataNormalizerTest extends UnitTestCase {
    

    It would be cool to have a @group Drupal at least.

  2. +++ b/core/modules/serialization/tests/Drupal/serialization/Tests/Normalizer/TypedDataNormalizerTest.php
    @@ -0,0 +1,65 @@
    +
    +  /**
    +   * Tests the supportsNormalization() method.
    +   */
    +  public function testSupportsNormalization() {
    +    $this->assertTrue($this->normalizer->supportsNormalization($this->typedData));
    +  }
    

    What about passing in some non typed data data?

damiankloip’s picture

FileSize
1.29 KB
2.16 KB

Great, thanks for the review! Here are those changes.

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

Thank you!

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed to 8.x. Thanks!

Automatically closed -- issue fixed for 2 weeks with no activity.