Esempio n. 1
0
 public function present()
 {
     $defaultClassPath = Looker::getPresenterClassPath();
     $presenterClassSuffix = Looker::getPresenterClassSuffix();
     if (!isset($this->presenter)) {
         $classPath = explode('\\', get_class($this));
         $className = $classPath[count($classPath) - 1];
         $root = substr(get_class(), 0, strpos(get_class(), '\\'));
         $this->presenter = $root . '\\' . $defaultClassPath . '\\' . $className . $presenterClassSuffix;
     }
     if (!class_exists($this->presenter)) {
         throw new InvalidPresenterException($className);
     }
     if (!isset($this->presenterInstance)) {
         $this->presenterInstance = new $this->presenter($this);
     }
     return $this->presenterInstance;
 }
Esempio n. 2
0
 /** @test */
 public function it_can_override_model_properties()
 {
     \Looker\Looker::init('Tests', 'Presenter');
     $model = new Looker\Tests\User();
     $this->assertEquals($model->age, $model->present()->age);
 }