You are here

public function NormalizerBaseTest::providerTestSupportsNormalization in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 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 47
Contains \Drupal\Tests\serialization\Unit\Normalizer\NormalizerBaseTest.

Class

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

Namespace

Drupal\Tests\serialization\Unit\Normalizer

Code

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