/** * @test */ public function itShouldBuildTheObject() { $disconnect = TwitterDisconnect::create($this->code, $this->streamName, $this->reason); $this->assertEquals($this->code, $disconnect->getCode()); $this->assertEquals($this->streamName, $disconnect->getStreamName()); $this->assertEquals($this->reason, $disconnect->getReason()); $this->assertEquals('Disconnect [' . $this->streamName . ']', (string) $disconnect); }
public function setUp() { $faker = Factory::create(); $this->code = (string) $faker->randomNumber(); $this->streamName = $faker->word; $this->reason = $faker->text(); $this->twitterDisconnect = TwitterDisconnect::create($this->code, $this->streamName, $this->reason); $this->serializedTwitterDisconnect = $this->getSerializedTwitterDisconnect(); $this->serviceUnderTest = new TwitterDisconnectSerializer(); }
/** * @param \stdClass $obj * @param array $context * @return TwitterDisconnect */ public function unserialize($obj, array $context = []) { Assertion::true($this->canUnserialize($obj), 'object is not unserializable'); $d = $obj->disconnect; return TwitterDisconnect::create($d->code, $d->stream_name, $d->reason); }