public function testInvalidPackage() { try { $this->app->getPackage('foobar'); } catch (\Exception $e) { $this->assertInstanceOf('\\Phavour\\Application\\Exception\\PackageNotFoundException', $e); return; } $this->fail('expected exception'); }
/** * 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; }