public function testResolver()
 {
     $_SERVER['REQUEST_METHOD'] = 'GET';
     $route = $this->routeResolver->process('/expressly/api/a2ea0a7e-eabd-4caf-a598-6b80887fc222/migrate');
     $this->assertInstanceOf('Expressly\\Entity\\Route', $route);
     $this->assertEquals($route->getName(), CampaignMigration::getName());
 }
Exemple #2
0
 /**
  * Default task
  */
 public function display($cachable = false, $urlparams = false)
 {
     // Get route
     $route = $this->app['route.resolver']->process($this->input->get('__xly', '', 'string'));
     if ($route instanceof \Expressly\Entity\Route) {
         switch ($route->getName()) {
             case Ping::getName():
                 $this->ping();
                 break;
             case UserData::getName():
                 $data = $route->getData();
                 $this->retrieveUserByEmail($data['email']);
                 break;
             case CampaignPopup::getName():
                 $data = $route->getData();
                 $this->migratestart($data['uuid']);
                 break;
             case CampaignMigration::getName():
                 $data = $route->getData();
                 $this->migratecomplete($data['uuid']);
                 break;
             case BatchCustomer::getName():
                 $this->batchCustomer();
                 break;
             case BatchInvoice::getName():
                 $this->batchInvoice();
                 break;
         }
     }
 }
Exemple #3
0
 public function match(RequestInterface $request)
 {
     if ($request->getModuleName() == null && method_exists($request, 'getPathInfo')) {
         $route = $this->application['route.resolver']->process($request->getPathInfo());
         if ($route instanceof Route) {
             switch ($route->getName()) {
                 case Ping::getName():
                     return $this->dispatch($request, 'ping');
                     break;
                 case Registered::getName():
                     return $this->dispatch($request, 'registered');
                     break;
                 case UserData::getName():
                     $data = $route->getData();
                     return $this->dispatch($request, 'user', 'index', $data);
                     break;
                 case CampaignPopup::getName():
                     $data = $route->getData();
                     return $this->dispatch($request, 'migration', 'popup', $data);
                     break;
                 case CampaignMigration::getName():
                     $data = $route->getData();
                     return $this->dispatch($request, 'migration', 'migrate', $data);
                     break;
                 case BatchCustomer::getName():
                     return $this->dispatch($request, 'batch', 'customer');
                     break;
                 case BatchInvoice::getName():
                     return $this->dispatch($request, 'batch', 'invoice');
                     break;
             }
         }
         if (http_response_code() === 401) {
             return $this->dispatch($request, 'unauthorized');
         }
     }
     //        return $this->actionFactory->create(Forward::class, ['request' => $request]);
 }