3 namespace Friendica\Test\Util;
5 use Mockery\MockInterface;
7 trait RendererMockTrait
10 * @var MockInterface The Interface for mocking a renderer
12 private $rendererMock;
15 * Mocking the method 'Renderer::getMarkupTemplate()'
17 * @param string $templateName The name of the template which should get
18 * @param string $return the return value of the mock (should be defined to have it later for followUp use)
19 * @param null|int $times How often the method will get used
21 public function mockGetMarkupTemplate($templateName, $return = '', $times = null)
23 if (!isset($this->rendererMock)) {
24 $this->rendererMock = \Mockery::mock('alias:Friendica\Core\Renderer');
28 ->shouldReceive('getMarkupTemplate')
35 * Mocking the method 'Renderer::replaceMacros()'
37 * @param string $template The template to use (normally, it is the mock result of 'mockGetMarkupTemplate()'
38 * @param array $args The arguments to pass to the macro
39 * @param string $return the return value of the mock
40 * @param null|int $times How often the method will get used
42 public function mockReplaceMacros($template, $args = [], $return = '', $times = null)
44 if (!isset($this->rendererMock)) {
45 $this->rendererMock = \Mockery::mock('alias:Friendica\Core\Renderer');
49 ->shouldReceive('replaceMacros')
50 ->with($template, $args)