parseField() public method

Parse a value based on a field yype of the schema.
public parseField ( mixed $value, string $fieldType ) : mixed
$value mixed Value to be parsed.
$fieldType string Description of how the field should be treated.
return mixed $value Value parsed to match $type
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'));
 }