Esempio n. 1
0
 protected function attachToPresenter(IComponent $component, $name = NULL)
 {
     if ($name === NULL) {
         if (!($name = $component->getName())) {
             $name = $component->getReflection()->getShortName();
         }
     }
     if (!$this->__testbench_presenterMock) {
         $this->__testbench_presenterMock = __testbench_getService('Testbench\\PresenterMock');
         $container = \Testbench\ContainerFactory::create(FALSE);
         $container->callInjects($this->__testbench_presenterMock);
     }
     $this->__testbench_presenterMock->onStartup[] = function (PresenterMock $presenter) use($component, $name) {
         try {
             $presenter->removeComponent($component);
         } catch (\Nette\InvalidArgumentException $exc) {
         }
         $presenter->addComponent($component, $name);
     };
     $this->__testbench_presenterMock->run(new ApplicationRequestMock());
 }