friendica/tests/Util/RendererMockTrait.php
Philipp Holzer 4f01a198e1
AutoInstall Test fix
- New Mock for Renderer
- No need of prepared assert.ini.php anymore
- Mocking Renderer during Autoinstall
2018-11-01 10:30:44 +01:00

47 lines
949 B
PHP

<?php
/**
* Created by PhpStorm.
* User: philipp
* Date: 01.11.18
* Time: 10:08
*/
namespace Friendica\Test\Util;
use Mockery\MockInterface;
trait RendererMockTrait
{
/**
* @var MockInterface The Interface for mocking a renderer
*/
private $rendererMock;
public function mockGetMarkupTemplate($templateName, $return = '', $times = null)
{
if (!isset($this->rendererMock)) {
$this->rendererMock = \Mockery::mock('alias:Friendica\Core\Renderer');
}
$this->rendererMock
->shouldReceive('getMarkupTemplate')
->with($templateName)
->times($times)
->andReturn($return);
}
public function mockReplaceMacros($template, $args = [], $return = '', $times = null)
{
if (!isset($this->rendererMock)) {
$this->rendererMock = \Mockery::mock('alias:Friendica\Core\Renderer');
}
$this->rendererMock
->shouldReceive('replaceMacros')
->with($template, $args)
->times($times)
->andReturn($return);
}
}