Exemplo n.º 1
0
 public function setUp()
 {
     global $appPackages;
     $this->app = new \Phavour\Application(APP_BASE, $appPackages);
     $this->app->setup();
     $this->view = new View($this->app, 'DefaultPackage', 'Index', 'index');
     $this->view->setConfig(array('foo' => 'bar', 'abc' => '123'));
 }
Exemplo n.º 2
0
 public function testInvalidPackage()
 {
     try {
         $this->app->getPackage('foobar');
     } catch (\Exception $e) {
         $this->assertInstanceOf('\\Phavour\\Application\\Exception\\PackageNotFoundException', $e);
         return;
     }
     $this->fail('expected exception');
 }
Exemplo n.º 3
0
 /**
  * Get the path for a view file.
  * @throws \Phavour\Application\Exception\PackageNotFoundException
  * @throws ViewFileNotFoundException
  * @return string
  */
 private function getPathForView()
 {
     $methodName = lcfirst($this->method);
     $className = lcfirst($this->class);
     $package = $this->app->getPackage($this->package);
     $pathPieces = array($package['package_path'], 'res', 'view', $className, $methodName);
     $path = implode(self::DS, $pathPieces) . '.phtml';
     if (file_exists($path)) {
         return $path;
     }
     $e = new ViewFileNotFoundException('Invalid view file path, expected: "' . $path . '"');
     $e->setAdditionalData('View Path Checked: ', $path);
     throw $e;
 }