/** * @test * @expectedException \RuntimeException */ public function shouldThrowIfEncoderNotRegistered() { $this->registry->getEncoder('unknown'); }
/** * Returns configured decoders/encoders factory * * @param FactoryInterface $factory * @return JsonApiRegistry */ private function getRegistry(FactoryInterface $factory) { $registry = new JsonApiRegistry(); $decoder = $this->getDecoder(); $registry->registerDecoder('jsonapi.decoders.jsonapi', function () use($decoder) { return $decoder; }); $encoder = $this->getEncoder($factory); $registry->registerEncoder('jsonapi.encoders.jsonapi', function () use($encoder) { return $encoder; }); return $registry; }