]> git.mxchange.org Git - friendica.git/blob - tests/Util/DateTimeFormatMockTrait.php
Merge pull request #6589 from rabuzarus/20190204_-_show_forum_account_in_vcard
[friendica.git] / tests / Util / DateTimeFormatMockTrait.php
1 <?php
2
3 namespace Friendica\Test\Util;
4
5 use Mockery\MockInterface;
6
7 trait DateTimeFormatMockTrait
8 {
9         /**
10          * @var MockInterface The mocking interface of Friendica\Database\DBA
11          */
12         private $dtfMock;
13
14         public function mockUtcNow($time, $times = null)
15         {
16                 if (!isset($this->dtfMock)) {
17                         $this->dtfMock = \Mockery::mock('alias:Friendica\Util\DateTimeFormat');
18                 }
19
20                 $this->dtfMock
21                         ->shouldReceive('utcNow')
22                         ->andReturn($time)
23                         ->times($times);
24         }
25
26         public function mockUtc($input, $time, $times = null)
27         {
28                 if (!isset($this->dtfMock)) {
29                         $this->dtfMock = \Mockery::mock('alias:Friendica\Util\DateTimeFormat');
30                 }
31
32                 $this->dtfMock
33                         ->shouldReceive('utc')
34                         ->with($input)
35                         ->andReturn($time)
36                         ->times($times);
37         }
38 }