function NormalizerBaseTest::providerTestSupportsNormalization

Same name in other branches
  1. 9 core/modules/serialization/tests/src/Unit/Normalizer/NormalizerBaseTest.php \Drupal\Tests\serialization\Unit\Normalizer\NormalizerBaseTest::providerTestSupportsNormalization()
  2. 8.9.x core/modules/serialization/tests/src/Unit/Normalizer/NormalizerBaseTest.php \Drupal\Tests\serialization\Unit\Normalizer\NormalizerBaseTest::providerTestSupportsNormalization()
  3. 10 core/modules/serialization/tests/src/Unit/Normalizer/NormalizerBaseTest.php \Drupal\Tests\serialization\Unit\Normalizer\NormalizerBaseTest::providerTestSupportsNormalization()

Data provider for testSupportsNormalization.

Return value

array An array of provider data for testSupportsNormalization.

File

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

Class

NormalizerBaseTest
@coversDefaultClass \Drupal\serialization\Normalizer\NormalizerBase @group serialization

Namespace

Drupal\Tests\serialization\Unit\Normalizer

Code

public static function providerTestSupportsNormalization() {
    return [
        // Something that is not an object should return FALSE immediately.
[
            FALSE,
            [],
        ],
        // An object with no class set should return FALSE.
[
            FALSE,
            new \stdClass(),
        ],
        // Set a supported Class.
[
            TRUE,
            new \stdClass(),
            'stdClass',
        ],
        // Set a supported interface.
[
            TRUE,
            new \RecursiveArrayIterator(),
            'RecursiveIterator',
        ],
        // Set a different class.
[
            FALSE,
            new \stdClass(),
            'ArrayIterator',
        ],
        // Set a different interface.
[
            FALSE,
            new \stdClass(),
            'RecursiveIterator',
        ],
    ];
}

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