9 namespace Friendica\Test\Util;
12 use Mockery\MockInterface;
14 trait RendererMockTrait
17 * @var MockInterface The Interface for mocking a renderer
19 private $rendererMock;
22 * Mocking the method 'Renderer::getMarkupTemplate()'
24 * @param string $templateName The name of the template which should get
25 * @param string $return the return value of the mock (should be defined to have it later for followUp use)
26 * @param null|int $times How often the method will get used
28 public function mockGetMarkupTemplate($templateName, $return = '', $times = null)
30 if (!isset($this->rendererMock)) {
31 $this->rendererMock = \Mockery::mock('alias:Friendica\Core\Renderer');
35 ->shouldReceive('getMarkupTemplate')
42 * Mocking the method 'Renderer::replaceMacros()'
44 * @param string $template The template to use (normally, it is the mock result of 'mockGetMarkupTemplate()'
45 * @param array $args The arguments to pass to the macro
46 * @param string $return the return value of the mock
47 * @param null|int $times How often the method will get used
49 public function mockReplaceMacros($template, $args = [], $return = '', $times = null)
51 if (!isset($this->rendererMock)) {
52 $this->rendererMock = \Mockery::mock('alias:Friendica\Core\Renderer');
56 ->shouldReceive('replaceMacros')
57 ->with($template, $args)