/** * @test */ public function itShouldBuildTheObject() { $coordinates = TwitterCoordinates::create($this->long, $this->lat, $this->type); $this->assertEquals($this->long, $coordinates->getLongitude()); $this->assertEquals($this->lat, $coordinates->getLatitude()); $this->assertEquals($this->type, $coordinates->getType()); }
public function setUp() { $faker = Factory::create(); $this->longitude = $faker->longitude; $this->latitude = $faker->latitude; $this->type = TwitterCoordinates::TYPE_POINT; $this->coordinates = TwitterCoordinates::create($this->longitude, $this->latitude, $this->type); $this->serviceUnderTest = new TwitterCoordinatesSerializer(); }
/** * @param \stdClass $obj * @param array $context * @return TwitterCoordinates */ public function unserialize($obj, array $context = []) { Assertion::true($this->canUnserialize($obj), 'object is not unserializable'); $coords = $obj->coordinates; return TwitterCoordinates::create($coords[0], $coords[1], $obj->type); }