2020-09-22 20:48:34 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Friendica\Test\Util;
|
|
|
|
|
|
|
|
use Friendica\Core\Hook;
|
|
|
|
use Mockery\MockInterface;
|
|
|
|
|
|
|
|
trait HookMockTrait
|
|
|
|
{
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var MockInterface The Interface for mocking a renderer
|
|
|
|
*/
|
|
|
|
private $hookMock;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Mocking a method 'Hook::call()' call
|
|
|
|
*
|
2020-10-18 18:31:57 +00:00
|
|
|
* @param string $name
|
|
|
|
* @param mixed $capture
|
2020-09-22 20:48:34 +00:00
|
|
|
*/
|
|
|
|
public function mockHookCallAll(string $name, &$capture)
|
|
|
|
{
|
|
|
|
if (!isset($this->hookMock)) {
|
|
|
|
$this->hookMock = \Mockery::mock('alias:' . Hook::class);
|
|
|
|
}
|
|
|
|
|
|
|
|
$this->hookMock
|
|
|
|
->shouldReceive('callAll')
|
|
|
|
->withArgs([$name, \Mockery::capture($capture)]);
|
|
|
|
}
|
|
|
|
}
|