/** * @param $Model * @param SchemaAbstract $Schema * @return null * @throws InvalidModelForSchemaException * @throws UnimplementedException */ public function buildBySchema($Model, SchemaAbstract $Schema) { $ResultSchema = $Schema->properties->result; $Builder = $this->_BuilderFactory->get($ResultSchema->type); $WrappedModel = new \stdClass(); $WrappedModel->result = $Model; $result = $Builder->buildValue($WrappedModel, 'result', $ResultSchema, $this->_BuilderFactory); return $result; }
/** * @expectedException \tomi20v\phalswag\Exception\UnimplementedException */ public function testShouldThrowOnInvalidType() { $Factory = new BySchemaFactory(); $Factory->get('invalidType'); }