/** * @test */ public function itShouldSerializeWithLegalObject() { $entityIndices = TwitterEntityIndices::create($this->from, $this->to); $serialized = $this->serviceUnderTest->serialize($entityIndices); $this->assertEquals($this->from, $serialized[0]); $this->assertEquals($this->to, $serialized[1]); }
/** * @test */ public function itShouldBuildTheObject() { $entityIndices = TwitterEntityIndices::create($this->from, $this->to); $this->assertEquals($this->from, $entityIndices->getFrom()); $this->assertEquals($this->to, $entityIndices->getTo()); }
/** * @param array $array * @param array $context * @return TwitterEntityIndices */ public function unserialize($array, array $context = []) { Assertion::true($this->canUnserialize($array), 'object is not unserializable'); return TwitterEntityIndices::create($array[0], $array[1]); }