public function testCanBeCreatedFromLocation()
 {
     $location = Location::fromCoordinates(Latitude::fromFloat(10.0), Longitude::fromFloat(10.0));
     $jsonLocation = JsonLocation::fromLocation($location);
     $this->assertInstanceOf(JsonLocation::class, $jsonLocation);
     return $jsonLocation;
 }
Example #2
0
 /**
  * @param HttpRequest $request
  */
 public function handle(HttpRequest $request)
 {
     if ($request->isPost() && $request->getUrl()->getFirstComponent() == 'containers') {
         return $this->writer->registerContainer();
     }
     if ($request->isGet() && $request->getUrl()->getFirstComponent() == 'containers') {
         $location = $this->reader->locateContainer(ContainerTrackingNumber::fromString($request->getUrl()->getSecondComponent()));
         $jsonLocation = JsonLocation::fromLocation($location);
         return $jsonLocation->json();
     }
 }