1 | <?php |
||
16 | class AppControllerTest extends ControllerTestUtility { |
||
17 | |||
18 | /** |
||
19 | * @var string |
||
20 | */ |
||
21 | private $appName; |
||
22 | |||
23 | /** |
||
24 | * @var \OCP\Irequest |
||
25 | */ |
||
26 | private $request; |
||
27 | |||
28 | /** |
||
29 | * @var \OCA\Chat\Controller\AppController |
||
30 | */ |
||
31 | private $controller; |
||
32 | |||
33 | /** |
||
34 | * @var \OCA\Chat\App\Chat |
||
35 | */ |
||
36 | private $chat; |
||
37 | |||
38 | public function setUp(){ |
||
39 | $this->appName = 'chat'; |
||
40 | $this->request = $this->getMockBuilder('\OCP\IRequest') |
||
41 | ->disableOriginalConstructor() |
||
42 | ->getMock(); |
||
43 | |||
44 | $this->userOnlineMapper = $this->getMockBuilder('\OCA\Chat\OCH\Db\UserOnlineMapper') |
||
|
|||
45 | ->disableOriginalConstructor() |
||
46 | ->getMock(); |
||
47 | |||
48 | $this->och = $this->getMockBuilder('\OCA\Chat\OCH\OCH') |
||
49 | ->disableOriginalConstructor() |
||
50 | ->getMock(); |
||
51 | |||
52 | $this->syncOnline = $this->getMockBuilder('\OCA\Chat\OCH\Commands\SyncOnline') |
||
53 | ->disableOriginalConstructor() |
||
54 | ->getMock(); |
||
55 | |||
56 | $this->contactsManager = $this->getMockBuilder('\OCP\Contacts\IManager') |
||
57 | ->disableOriginalConstructor() |
||
58 | ->getMock(); |
||
59 | |||
60 | $this->backendManager = $this->getMockBuilder('\OCA\Chat\IBackendManager') |
||
61 | ->disableOriginalConstructor() |
||
62 | ->getMock(); |
||
63 | |||
64 | $this->user = $this->getMockBuilder('\OCP\IUser') |
||
65 | ->disableOriginalConstructor() |
||
66 | ->getMock(); |
||
67 | |||
68 | $this->rootFolder = $this->getMockBuilder('\OCP\Files\IRootFolder') |
||
69 | ->disableOriginalConstructor() |
||
70 | ->getMock(); |
||
71 | |||
72 | $this->greet = $this->getMockBuilder('\OCA\Chat\OCH\Commands\Greet') |
||
73 | ->disableOriginalConstructor() |
||
74 | ->getMock(); |
||
75 | |||
76 | $this->greet = $this->getMockBuilder('\OCP\IConfig') |
||
77 | ->disableOriginalConstructor() |
||
78 | ->getMock(); |
||
79 | |||
80 | $this->chat = new Chat( |
||
81 | $this->backendManager, |
||
82 | $this->userOnlineMapper, |
||
83 | $this->syncOnline, |
||
84 | $this->user, |
||
85 | $this->contactsManager, |
||
86 | $this->rootFolder |
||
87 | ); |
||
88 | |||
89 | $this->controller = new AppController( |
||
90 | $this->appName, |
||
91 | $this->request, |
||
92 | $this->chat, |
||
93 | $this->contactsManager, |
||
94 | $this->config, |
||
95 | $this->greet |
||
96 | ); |
||
97 | } |
||
98 | |||
99 | |||
100 | public function testIndexAnnotations(){ |
||
104 | |||
105 | public function testContactsAnnotations(){ |
||
109 | |||
110 | // |
||
111 | public function indexProvider(){ |
||
186 | |||
187 | /** |
||
188 | * @dataProvider indexProvider |
||
189 | */ |
||
190 | public function testIndex($currentUser, $greetRequestData, $contacts, $backends, $initConvs, $sessionId){ |
||
232 | // |
||
233 | // |
||
234 | public function contactsProvider(){ |
||
245 | |||
246 | /** |
||
247 | * @dataProvider contactsProvider |
||
248 | */ |
||
249 | public function testContacts($contacts){ |
||
264 | |||
265 | } |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: