Ejemplo n.º 1
0
 public function testSetValues()
 {
     $file = new File(__DIR__ . '/fixtures/hello-world.php');
     $file->setValues(['foo' => 'foo string', 'bar' => 'bar string']);
     $this->assertAttributeEquals(['foo' => 'foo string', 'bar' => 'bar string'], 'values', $file);
     // merged
     $file->setValues(['bar' => 'changed bar string', 'baz' => 'baz string']);
     $this->assertAttributeEquals(['foo' => 'foo string', 'bar' => 'changed bar string', 'baz' => 'baz string'], 'values', $file);
 }
Ejemplo n.º 2
0
 /**
  * @return string
  */
 public function render()
 {
     $templateLast = Template::setInstance($this);
     $contents = $this->capture(function () {
         extract($this->values);
         require $this->fileName;
     });
     Template::setInstance($templateLast);
     if (isset($this->layout)) {
         return $this->layout->setSection('main', $contents)->render();
     }
     return $contents;
 }