コード例 #1
0
ファイル: ListNormalizerTest.php プロジェクト: 318io/318-io
 /**
  * Tests the normalize() method.
  */
 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);
 }
コード例 #2
0
  /**
   * Tests the normalize() method.
   */
  public function testNormalize() {
    $serializer = $this->prophesize(Serializer::class);
    $serializer->normalize($this->typedData, 'json', ['mu' => 'nu'])
      ->shouldBeCalledTimes(3)
      ->willReturn('test');

    $this->normalizer->setSerializer($serializer->reveal());

    $normalized = $this->normalizer->normalize($this->list, 'json', ['mu' => 'nu']);

    $this->assertEquals($this->expectedListValues, $normalized);
  }