You are here

public function ListNormalizerTest::testNormalize in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/serialization/tests/src/Unit/Normalizer/ListNormalizerTest.php \Drupal\Tests\serialization\Unit\Normalizer\ListNormalizerTest::testNormalize()

Tests the normalize() method.

File

core/modules/serialization/tests/src/Unit/Normalizer/ListNormalizerTest.php, line 82
Contains \Drupal\Tests\serialization\Unit\Normalizer\ListNormalizerTest.

Class

ListNormalizerTest
@coversDefaultClass \Drupal\serialization\Normalizer\ListNormalizer @group serialization

Namespace

Drupal\Tests\serialization\Unit\Normalizer

Code

public function testNormalize() {
  $serializer = $this
    ->getMockBuilder('Symfony\\Component\\Serializer\\Serializer')
    ->setMethods(array(
    'normalize',
  ))
    ->getMock();
  $serializer
    ->expects($this
    ->exactly(3))
    ->method('normalize')
    ->will($this
    ->returnValue('test'));
  $this->normalizer
    ->setSerializer($serializer);
  $normalized = $this->normalizer
    ->normalize($this->list);
  $this
    ->assertEquals($this->expectedListValues, $normalized);
}