'bar', ); $serializer = $this->getMockBuilder('JMS\SerializerBundle\Serializer\Serializer') ->setMethods(array('denormalize')) ->disableOriginalConstructor() ->getMock(); $serializer ->expects($this->once()) ->method('denormalize') ->with($this->equalTo($data), $this->equalTo('array')) ->will($this->returnValue(array('foo' => $obj = new \stdClass))) ; $normalizer = new ArrayCollectionNormalizer(); $normalizer->setSerializer($serializer); $denormalized = $normalizer->denormalize($data, 'ArrayCollection'); $this->assertInstanceOf('Doctrine\Common\Collections\ArrayCollection', $denormalized); $this->assertSame($obj, $denormalized['foo']); } public function testSupportsDenormalization() { $normalizer = new ArrayCollectionNormalizer(); $this->assertTrue($normalizer->supportsDenormalization(null, 'ArrayCollection<>')); $this->assertFalse($normalizer->supportsDenormalization(null, 'ArrayCollection')); } }