/** * @test */ function it_can_be_converted_to_array_and_back() { $processingTypes = ProcessingTypes::support([String::prototype(), Integer::prototype()]); $definition = $processingTypes->toArray(); $copiedProcessingTypes = ProcessingTypes::fromArray($definition); $this->assertTrue($copiedProcessingTypes->isSupported(String::prototype())); $this->assertTrue($copiedProcessingTypes->isSupported(Integer::prototype())); $this->assertFalse($copiedProcessingTypes->isSupported(Float::prototype())); $allProcessingTypes = ProcessingTypes::supportAll(); $definition = $allProcessingTypes->toArray(); $copiedProcessingTypes = ProcessingTypes::fromArray($definition); $this->assertTrue($copiedProcessingTypes->isSupported(Float::prototype())); }
/** * @return array[propertyName => Prototype] */ public static function getPropertyPrototypes() { return ['name' => \Prooph\Processing\Type\String::prototype(), 'age' => \Prooph\Processing\Type\Integer::prototype(), 'created_at' => \Prooph\Processing\Type\DateTime::prototype(), 'price' => \Prooph\Processing\Type\Float::prototype(), 'active' => \Prooph\Processing\Type\Boolean::prototype()]; }
/** * @test */ public function it_is_same_value_as_equal_float() { $float1 = Float::fromNativeValue(10.1); $float2 = Float::fromNativeValue(10.1); $float3 = Float::fromNativeValue(10.0); $this->assertTrue($float1->sameAs($float2)); $this->assertFalse($float1->sameAs($float3)); }