예제 #1
0
 public function testAddRenderTemplate()
 {
     $this->templateMock2->expects($this->any())->method('setArguments')->will($this->returnValue($this->templateMock2));
     $this->testInstance->add($this->templateMock1, 'first');
     $this->testInstance->add($this->templateMock2, 'second');
     $this->templateMock1->expects($this->once())->method('render')->will($this->returnValue($mock1Val = uniqid()));
     $this->templateMock2->expects($this->any())->method('render')->will($this->returnValue($mock2Val = uniqid()));
     $fakeArgs = ['varName' => uniqid('varName')];
     $this->assertSame($mock1Val, $this->testInstance->straightRender($this->templateMock1));
     $this->assertSame($mock2Val, $this->testInstance->render('second', $fakeArgs));
     $this->viewFactoryMock->expects($this->any())->method('make')->with($viewName = uniqid('viewName'))->will($this->returnValue($this->viewMock));
     $this->assertSame($mock2Val, $this->testInstance->renderOnce('second', $fakeArgs, $viewName));
 }
예제 #2
0
 public function add(TemplateCompiler $compiler, $name, array $arguments = [])
 {
     $this->templates[$name] = $compiler->setArguments($arguments);
 }