Пример #1
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();
     }
 }
 /**
  * @depends testCanBeCreatedFromLocation
  */
 public function testCanBeFormattedCorrectly(JsonLocation $jsonLocation)
 {
     $this->assertEquals('{"latitude":10,"longitude":10}', $jsonLocation->json());
 }