Example #1
0
 /**
  * Create a new page with a reference to its component and the file in which
  * it is defined.
  *
  * Also, by default, the page will be configured to look for view scripts
  * in the view-scripts sub-folder of its component.
  *
  * @param ComponentAbstract $component
  * @param Request $request
  * @param string $viewScriptPath
  */
 public function __construct(ComponentAbstract $component, Request $request, $viewScriptPath = null)
 {
     $this->component = $component;
     $this->view = Pimple::getResource('view');
     $this->request = $request ?: $this->application['dewdrop-request'];
     if (null === $viewScriptPath) {
         $viewScriptPath = $this->component->getPath() . '/view-scripts';
     }
     $this->view->setScriptPath($viewScriptPath)->helper('AdminUrl')->setPage($this);
 }
 public function testGetPathReturnsCorrectPath()
 {
     $reflectionClass = new \ReflectionClass($this->component);
     $testPath = dirname($reflectionClass->getFileName());
     $this->assertEquals($testPath, $this->component->getPath());
 }