Exemple #1
0
 public function testThatToStringIsAliasToRender()
 {
     $text = 'some text';
     $arguments = ['arg1', 'arg2'];
     $result = 'rendered text';
     $this->phrase = new \Magento\Framework\Phrase($text, $arguments);
     $this->renderer->expects($this->once())->method('render')->with([$text], $arguments)->will($this->returnValue($result));
     $this->assertEquals($result, (string) $this->phrase);
 }
 /**
  * Test that to string is alias to render
  *
  * @return void
  */
 public function testThatToStringIsAliasToRender()
 {
     $text = 'some text';
     $arguments = ['arg1', 'arg2'];
     $result = 'rendered text';
     $phrase = new Phrase($text, $arguments);
     Phrase::setRenderer($this->rendererMock);
     $this->rendererMock->expects($this->once())->method('render')->with([$text], $arguments)->willReturn($result);
     $this->assertEquals($result, (string) $phrase);
 }
 public function testToStringWithExceptionOnRender()
 {
     $text = 'raw text';
     $exception = new \Exception('something went wrong');
     $phrase = new Phrase($text);
     $this->rendererMock->expects($this->any())->method('render')->willThrowException($exception);
     $this->assertEquals($text, (string) $phrase);
 }