/** * @dataProvider normalizeDataProvider */ public function testNormalize($proc, $procForCompare, $iterations) { $supportedNormalizer = $this->getMock('Oro\\Bundle\\ImportExportBundle\\Serializer\\Normalizer\\NormalizerInterface'); $supportedNormalizer->expects($this->exactly($iterations))->method('supportsNormalization')->will($this->returnValue(true)); $nonSupportedNormalizer = $this->getMock('Oro\\Bundle\\ImportExportBundle\\Serializer\\Normalizer\\NormalizerInterface'); $nonSupportedNormalizer->expects($this->exactly($iterations))->method('supportsNormalization')->will($this->returnValue(false)); $denormalizer = $this->getMock('Oro\\Bundle\\ImportExportBundle\\Serializer\\Normalizer\\DenormalizerInterface'); $this->serializer = new Serializer([$denormalizer, $nonSupportedNormalizer, $supportedNormalizer]); $this->serializer->supportsNormalization(new \stdClass()); $this->serializer->normalize(new \stdClass(), null, [Serializer::PROCESSOR_ALIAS_KEY => $proc]); $this->serializer->normalize(new \stdClass(), null, [Serializer::PROCESSOR_ALIAS_KEY => $procForCompare]); }
/** * @param array $addresses * * @return array */ protected function getPlainData(array $addresses = []) { $data = []; array_walk_recursive($addresses, function ($item, $key) use(&$data) { if ($item instanceof AbstractAddress) { $data[$key] = $this->serializer->normalize($item); } }); return $data; }