When instantiating a SchemaMapper you should provide a Schema. When calling 'map' the Schema provided will be used to format the data to the correct format. This class is meant to do the opposite of the EntityAssembler
Ejemplo n.º 1
0
 public function testShouldParseFieldIntoCastableType()
 {
     // Arrange
     $schema = m::mock(Schema::class);
     $schemaMapper = new SchemaMapper($schema);
     // Assert
     $this->assertSame(23, $schemaMapper->parseField('23', 'int'));
     $this->assertSame('1234', $schemaMapper->parseField(1234, 'string'));
 }