AutoInstall Test fix
- New Mock for Renderer - No need of prepared assert.ini.php anymore - Mocking Renderer during Autoinstall
This commit is contained in:
parent
cbc5e12ea8
commit
4f01a198e1
4 changed files with 79 additions and 120 deletions
46
tests/Util/RendererMockTrait.php
Normal file
46
tests/Util/RendererMockTrait.php
Normal 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);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue