]> git.mxchange.org Git - friendica.git/blob - tests/Util/RendererMockTrait.php
AutoInstall Test fix
[friendica.git] / tests / Util / RendererMockTrait.php
1 <?php
2 /**
3  * Created by PhpStorm.
4  * User: philipp
5  * Date: 01.11.18
6  * Time: 10:08
7  */
8
9 namespace Friendica\Test\Util;
10
11
12 use Mockery\MockInterface;
13
14 trait RendererMockTrait
15 {
16         /**
17          * @var MockInterface The Interface for mocking a renderer
18          */
19         private $rendererMock;
20
21         public function mockGetMarkupTemplate($templateName, $return = '', $times = null)
22         {
23                 if (!isset($this->rendererMock)) {
24                         $this->rendererMock = \Mockery::mock('alias:Friendica\Core\Renderer');
25                 }
26
27                 $this->rendererMock
28                         ->shouldReceive('getMarkupTemplate')
29                         ->with($templateName)
30                         ->times($times)
31                         ->andReturn($return);
32         }
33
34         public function mockReplaceMacros($template, $args = [], $return = '', $times = null)
35         {
36                 if (!isset($this->rendererMock)) {
37                         $this->rendererMock = \Mockery::mock('alias:Friendica\Core\Renderer');
38                 }
39
40                 $this->rendererMock
41                         ->shouldReceive('replaceMacros')
42                         ->with($template, $args)
43                         ->times($times)
44                         ->andReturn($return);
45         }
46 }