|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is part of the MilioooMessageBundle package. |
|
5
|
|
|
* |
|
6
|
|
|
* (c) Michiel boeckaert <[email protected]> |
|
7
|
|
|
* This source file is subject to the MIT license that is bundled |
|
8
|
|
|
* with this source code in the file LICENSE. |
|
9
|
|
|
*/ |
|
10
|
|
|
|
|
11
|
|
|
namespace Miliooo\Messaging\Tests\ThreadProvider\Folder; |
|
12
|
|
|
|
|
13
|
|
|
use Miliooo\Messaging\ThreadProvider\Folder\InboxProviderPagerFanta; |
|
14
|
|
|
use Miliooo\Messaging\TestHelpers\ParticipantTestHelper; |
|
15
|
|
|
use Miliooo\Messaging\User\ParticipantInterface; |
|
16
|
|
|
|
|
17
|
|
|
/** |
|
18
|
|
|
* Test file for inbox provider pagerfanta |
|
19
|
|
|
* |
|
20
|
|
|
* @author Michiel Boeckaert <[email protected]> |
|
21
|
|
|
*/ |
|
22
|
|
|
class InboxProviderPagerFantaTest extends \PHPUnit_Framework_TestCase |
|
23
|
|
|
{ |
|
24
|
|
|
/** |
|
25
|
|
|
* @var InboxProviderPagerFanta |
|
26
|
|
|
*/ |
|
27
|
|
|
private $threadProvider; |
|
28
|
|
|
|
|
29
|
|
|
/** |
|
30
|
|
|
* @var \PHPUnit_Framework_MockObject_MockObject |
|
31
|
|
|
*/ |
|
32
|
|
|
private $threadRepository; |
|
33
|
|
|
|
|
34
|
|
|
/** |
|
35
|
|
|
* @var ParticipantInterface |
|
36
|
|
|
*/ |
|
37
|
|
|
private $participant; |
|
38
|
|
|
|
|
39
|
|
|
/** |
|
40
|
|
|
* @var \PHPUnit_Framework_MockObject_MockObject |
|
41
|
|
|
*/ |
|
42
|
|
|
private $queryBuilderMock; |
|
43
|
|
|
|
|
44
|
|
|
public function setUp() |
|
45
|
|
|
{ |
|
46
|
|
|
$this->participant = new ParticipantTestHelper(1); |
|
47
|
|
|
$this->threadRepository = $this->getMock('Miliooo\Messaging\Repository\ThreadRepositoryInterface'); |
|
48
|
|
|
$this->threadProvider = new InboxProviderPagerFanta($this->threadRepository, 15); |
|
49
|
|
|
$this->queryBuilderMock = $this->getMockBuilder('Doctrine\ORM\QueryBuilder') |
|
50
|
|
|
->disableOriginalConstructor() |
|
51
|
|
|
->getMock(); |
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
|
|
public function testInterface() |
|
55
|
|
|
{ |
|
56
|
|
|
$this->assertInstanceOf( |
|
57
|
|
|
'Miliooo\Messaging\ThreadProvider\Folder\InboxProviderPagerFantaInterface', |
|
58
|
|
|
$this->threadProvider |
|
59
|
|
|
); |
|
60
|
|
|
} |
|
61
|
|
|
|
|
62
|
|
|
public function testGetOutboxThreadsReturnsPagerFantaObject() |
|
63
|
|
|
{ |
|
64
|
|
|
$this->threadRepository |
|
65
|
|
|
->expects($this->once()) |
|
66
|
|
|
->method('getInboxThreadsForParticipantQueryBuilder') |
|
67
|
|
|
->will($this->returnValue($this->queryBuilderMock)); |
|
68
|
|
|
|
|
69
|
|
|
$result = $this->threadProvider->getInboxThreadsPagerfanta($this->participant, 1); |
|
70
|
|
|
$this->assertInstanceOf('Pagerfanta\Pagerfanta', $result); |
|
71
|
|
|
} |
|
72
|
|
|
} |
|
73
|
|
|
|