]> git.mxchange.org Git - friendica.git/blob - tests/Util/HookMockTrait.php
Merge pull request #10294 from annando/http-input-data
[friendica.git] / tests / Util / HookMockTrait.php
1 <?php
2
3 namespace Friendica\Test\Util;
4
5 use Friendica\Core\Hook;
6 use Mockery\MockInterface;
7
8 trait HookMockTrait
9 {
10
11         /**
12          * @var MockInterface The Interface for mocking a renderer
13          */
14         private $hookMock;
15
16         /**
17          * Mocking a method 'Hook::call()' call
18          *
19          * @param string $name
20          * @param mixed  $capture
21          */
22         public function mockHookCallAll(string $name, &$capture)
23         {
24                 if (!isset($this->hookMock)) {
25                         $this->hookMock = \Mockery::mock('alias:' . Hook::class);
26                 }
27
28                 $this->hookMock
29                         ->shouldReceive('callAll')
30                         ->withArgs([$name, \Mockery::capture($capture)]);
31         }
32 }