1
0
Fork 0

fixing auto install tests

This commit is contained in:
Philipp Holzer 2019-04-13 21:59:05 +02:00
commit 3a0664d827
No known key found for this signature in database
GPG key ID: 517BE60E2CE5C8A5
5 changed files with 47 additions and 48 deletions

View file

@ -15,9 +15,9 @@ trait RendererMockTrait
/**
* Mocking the method 'Renderer::getMarkupTemplate()'
*
* @param string $templateName The name of the template which should get
* @param string $return the return value of the mock (should be defined to have it later for followUp use)
* @param null|int $times How often the method will get used
* @param string $templateName The name of the template which should get
* @param string $return the return value of the mock (should be defined to have it later for followUp use)
* @param null|int $times How often the method will get used
*/
public function mockGetMarkupTemplate($templateName, $return = '', $times = null)
{
@ -35,12 +35,13 @@ trait RendererMockTrait
/**
* Mocking the method 'Renderer::replaceMacros()'
*
* @param string $template The template to use (normally, it is the mock result of 'mockGetMarkupTemplate()'
* @param array|\Closure|null $args The arguments to pass to the macro
* @param string $return the return value of the mock
* @param null|int $times How often the method will get used
* @param string $template The template to use (normally, it is the mock result of 'mockGetMarkupTemplate()'
* @param array|\Closure|null $args The arguments to pass to the macro
* @param bool $overwriteURL if the URL should get overwritten
* @param string $return the return value of the mock
* @param null|int $times How often the method will get used
*/
public function mockReplaceMacros($template, $args = null, $return = '', $times = null)
public function mockReplaceMacros($template, $args = null, $overwriteURL = true, $return = '', $times = null)
{
if (!isset($this->rendererMock)) {
$this->rendererMock = \Mockery::mock('alias:' . Renderer::class);
@ -50,10 +51,18 @@ trait RendererMockTrait
$args = [];
}
$this->rendererMock
->shouldReceive('replaceMacros')
->with($template, $args)
->times($times)
->andReturn($return);
if ($overwriteURL) {
$this->rendererMock
->shouldReceive('replaceMacros')
->with($template, $args)
->times($times)
->andReturn($return);
} else {
$this->rendererMock
->shouldReceive('replaceMacros')
->with($template, $args, false)
->times($times)
->andReturn($return);
}
}
}