コード例 #1
0
ファイル: Application.php プロジェクト: MikeGeorgeff/siphon
 /**
  * {@inheritdoc}
  */
 public function register($command)
 {
     if (is_string($command)) {
         $command = $this->siphon->get($command);
     }
     if ($command instanceof Command) {
         $command->setSiphon($this->siphon);
     }
     return $this->addToParent($command);
 }
コード例 #2
0
             expect($request)->toBeAnInstanceOf('Symfony\\Component\\HttpFoundation\\Request');
             expect($response)->toBeAnInstanceOf('Symfony\\Component\\HttpFoundation\\Response');
         });
         ob_start();
         $app->run();
         ob_get_clean();
     });
 });
 describe("->router()", function () {
     it("registers a route with the application", function () {
         $app = new Application();
         $app->boot();
         $action = function () {
         };
         $app->router('get', '/route', $action);
         $router = $app->get('router');
         expect($router->getRoutes())->toBe(['GET/route' => ['method' => 'GET', 'uri' => '/route', 'action' => $action]]);
     });
     it("throws a RuntimeException if the method does not exist in the route collection", function () {
         $closure = function () {
             $app = new Application();
             $app->boot();
             $app->router('foo', '/route', function () {
             });
         };
         expect($closure)->toThrow(new RuntimeException());
     });
 });
 describe("->basePath()", function () {
     it("returns the base application install path", function () {
         $app = new Application();