/** * @test */ public function it_constructs_a_prototype() { $stringPrototype = String::prototype(); $this->assertEquals('Prooph\\Processing\\Type\\String', $stringPrototype->of()); $description = $stringPrototype->typeDescription(); $this->assertEquals('String', $description->label()); $this->assertEquals('string', $description->nativeType()); $this->assertFalse($description->hasIdentifier()); }
/** * @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 array('id' => Integer::prototype(), 'name' => String::prototype(), 'address' => SourceAddress::prototype()); }
/** * @return array[propertyName => Prototype] */ public static function getPropertyPrototypes() { return ['id' => IntegerOrNull::prototype(), 'name' => String::prototype(), 'age' => Integer::prototype()]; }
/** * Returns the prototype of the items type * * A collection has always one property with name item representing the type of all items in the collection. * * @return Prototype */ public static function itemPrototype() { return String::prototype(); }
/** * @return array[propertyName => Prototype] */ public static function getPropertyPrototypes() { return array('street' => String::prototype(), 'streetNumber' => Integer::prototype(), 'zip' => String::prototype(), 'city' => String::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()]; }
/** * @return array[propertyName => Prototype] */ public static function getPropertyPrototypes() { return ['ean' => String::prototype(), 'name' => String::prototype(), 'price' => Integer::prototype(), 'currency' => String::prototype()]; }
/** * @test */ function it_is_equal_to_a_similar_message() { $message1 = Message::emulateProcessingWorkflowMessage(MessageType::collectData(), String::prototype(), ProcessingMetadata::fromArray(['meta' => 'data'])); $message2 = Message::emulateProcessingWorkflowMessage(MessageType::collectData(), String::prototype(), ProcessingMetadata::fromArray(['meta' => 'data'])); $this->assertTrue($message1->equals($message2)); }