Example #1
0
 /**
  * @test
  */
 public function assignMultipleCanOverridePreviouslyAssignedValues()
 {
     $this->templateVariableContainer->expects($this->at(0))->method('add')->with('foo', 'FooValue');
     $this->templateVariableContainer->expects($this->at(1))->method('add')->with('foo', 'FooValueOverridden');
     $this->templateVariableContainer->expects($this->at(2))->method('add')->with('bar', 'BarValue');
     $this->view->assign('foo', 'FooValue');
     $this->view->assignMultiple(['foo' => 'FooValueOverridden', 'bar' => 'BarValue']);
 }
 /**
  * @test
  */
 public function assignMultipleCanOverridePreviouslyAssignedValues()
 {
     $this->templateVariableContainer->expects($this->at(0))->method('exists')->with('foo')->will($this->returnValue(FALSE));
     $this->templateVariableContainer->expects($this->at(1))->method('add')->with('foo', 'FooValue');
     $this->templateVariableContainer->expects($this->at(2))->method('exists')->with('foo')->will($this->returnValue(TRUE));
     $this->templateVariableContainer->expects($this->at(3))->method('remove')->with('foo');
     $this->templateVariableContainer->expects($this->at(4))->method('add')->with('foo', 'FooValueOverridden');
     $this->templateVariableContainer->expects($this->at(5))->method('exists')->with('bar')->will($this->returnValue(FALSE));
     $this->templateVariableContainer->expects($this->at(6))->method('add')->with('bar', 'BarValue');
     $this->view->assign('foo', 'FooValue');
     $this->view->assignMultiple(array('foo' => 'FooValueOverridden', 'bar' => 'BarValue'));
 }
 /**
  * Renders a given section.
  *
  * @param string $sectionName Name of section to render
  * @param array $variables The variables to use
  * @param boolean $ignoreUnknown Ignore an unknown section and just return an empty string
  * @return string rendered template for the section
  * @throws InvalidSectionException
  */
 public function renderSection($sectionName, array $variables = [], $ignoreUnknown = false)
 {
     if ($this->getCurrentParsedTemplate() === null) {
         return $this->renderStandaloneSection($sectionName, $variables, $ignoreUnknown);
     }
     return parent::renderSection($sectionName, $variables, $ignoreUnknown);
 }