Ejemplo n.º 1
0
 public static function configurePDC(PrimaryDependencyContainer $pdc)
 {
     $pdc->setTemplateFactory(new DeferredTemplateFactory(function () use($pdc) {
         $refl = new \ReflectionClass(TemplateFactory::class);
         if ($refl->getConstructor()->getParameters()[2]->getClass()->getName() === IResponse::class) {
             // Latte < 2.4
             return new TemplateFactory(new FakeLatteFactory(), $pdc->getUsedHttpRequest(), $pdc->getHttpResponse(), $pdc->getUserService(), new DevNullStorage());
         } else {
             // Latte >= 2.4
             return new TemplateFactory(new FakeLatteFactory(), $pdc->getUsedHttpRequest(), $pdc->getUserService(), new DevNullStorage());
         }
     }));
 }
Ejemplo n.º 2
0
 public function runPresenter()
 {
     $presenter = $this->createPresenter();
     $this->primaryDependencyContainer->injectTo($presenter);
     $this->dependencyContainer->injectTo($presenter);
     $presenter->autoCanonicalize = FALSE;
     $appResponse = $presenter->run($this->primaryDependencyContainer->getUsedAppRequest());
     ob_start();
     $appResponse->send($this->primaryDependencyContainer->getUsedHttpRequest(), $this->primaryDependencyContainer->getHttpResponse());
     $responseBody = ob_get_clean();
     return new TestResult($this->primaryDependencyContainer->getHttpResponse(), $appResponse, $responseBody);
 }