/** * @test */ public function it_has_a_convenient_description() { $string = String::fromNativeValue("Hello World"); $description = $string->description(); $this->assertEquals('String', $description->label()); $this->assertEquals('string', $description->nativeType()); $this->assertFalse($description->hasIdentifier()); }
public function provideStringCollection() { $string1 = String::fromNativeValue("Processing"); $string2 = String::fromNativeValue("Workflow"); $string3 = String::fromNativeValue("Framework"); $stringCollection = StringCollection::fromNativeValue([$string1, $string2, $string3]); return [[$stringCollection]]; }
/** * @test */ function it_can_be_set_up_from_array() { $task = ManipulatePayload::with(__DIR__ . '/../../Mock/manipulation/append_world.php'); $taskData = $task->getArrayCopy(); $copiedTask = ManipulatePayload::reconstituteFromArray($taskData); $payload = Payload::fromType(String::fromNativeValue('Hello')); $copiedTask->performManipulationOn($payload); $this->assertEquals('Hello World', $payload->extractTypeData()); }
public function provideStringCollection() { $string1 = String::fromNativeValue("Processing"); $string2 = String::fromNativeValue("Workflow"); $string3 = String::fromNativeValue("Framework"); $string4 = String::fromNativeValue("Prooph"); $string5 = String::fromNativeValue("Link"); $string6 = String::fromNativeValue("Application"); $stringCollection = StringCollection::fromNativeValue([$string1, $string2, $string3, $string4, $string5, $string6]); return [[$stringCollection]]; }
/** * @test */ public function it_constructs_collection_from_json_decoded_value() { $fruits = StringCollection::fromNativeValue(array("Apple", String::fromNativeValue("Banana"), "Strawberry")); $jsonString = json_encode($fruits); $decodedJson = json_decode($jsonString); $decodedFruits = StringCollection::fromJsonDecodedData($decodedJson); $fruitList = array(); foreach ($decodedFruits->value() as $fruit) { $fruitList[] = $fruit->value(); } $this->assertEquals(array("Apple", "Banana", "Strawberry"), $fruitList); }
/** * @test */ function it_manipulates_data_of_payload_with_callback() { $addWorld = Func::prepare('manipulate', null, function ($string) { return $string . ' World'; }); $payload = Payload::fromType(String::fromNativeValue('Hello')); $addWorld($payload); $this->assertEquals('Hello World', $payload->extractTypeData()); }