public function testNormalize() { $format = null; $context = array('context'); $firstElement = $this->getMock('FirstObject'); $secondElement = $this->getMock('SecondObject'); $data = new ArrayCollection(array($firstElement, $secondElement)); $this->serializer->expects($this->exactly(2))->method('normalize')->will($this->returnValueMap(array(array($firstElement, $format, $context, 'first'), array($secondElement, $format, $context, 'second')))); $this->assertEquals(array('first', 'second'), $this->normalizer->normalize($data, $format, $context)); }