/**
  * @covers Yosmanyga\Resource\Normalizer\DelegatorNormalizer::normalize
  */
 public function testNormalize()
 {
     $data = array();
     $resource = new Resource();
     $internalNormalizer1 = $this->getMock('Yosmanyga\\Resource\\Normalizer\\NormalizerInterface');
     $internalNormalizer1->expects($this->once())->method('supports')->will($this->returnValue(true));
     $internalNormalizer1->expects($this->once())->method('normalize')->with($data, $resource);
     $delegatorNormalizer = new DelegatorNormalizer(array($internalNormalizer1));
     $delegatorNormalizer->normalize($data, $resource);
 }
Example #2
0
 /**
  * @param \Yosmanyga\Resource\Normalizer\NormalizerInterface[] $normalizers
  */
 public function __construct($normalizers = array())
 {
     $normalizers = $normalizers ?: array(new YamlFileNormalizer(), new XmlFileNormalizer(), new SuddenAnnotationFileNormalizer(), new DirectoryNormalizer(array(new YamlFileNormalizer(), new XmlFileNormalizer(), new SuddenAnnotationFileNormalizer())));
     parent::__construct($normalizers);
 }
 /**
  * @inheritdoc
  */
 public function normalize($data, Resource $resource)
 {
     return parent::normalize($data, $this->convertResource($resource));
 }