1
0
Fork 0

AutoInstall Test fix

- New Mock for Renderer
- No need of prepared assert.ini.php anymore
- Mocking Renderer during Autoinstall
This commit is contained in:
Philipp Holzer 2018-11-01 10:30:44 +01:00
commit 4f01a198e1
No known key found for this signature in database
GPG key ID: 517BE60E2CE5C8A5
4 changed files with 79 additions and 120 deletions

View file

@ -0,0 +1,46 @@
<?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);
}
}