]> git.mxchange.org Git - friendica.git/blob - tests/datasets/api.fixture.php
a07232a8c00e3d8a71fb6539b1ed2acd6e6b2b4b
[friendica.git] / tests / datasets / api.fixture.php
1 <?php
2 /**
3  * @copyright Copyright (C) 2020, Friendica
4  *
5  * @license GNU AGPL version 3 or any later version
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU Affero General Public License as
9  * published by the Free Software Foundation, either version 3 of the
10  * License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU Affero General Public License for more details.
16  *
17  * You should have received a copy of the GNU Affero General Public License
18  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
19  *
20  */
21
22 use Friendica\Core\Protocol;
23 use Friendica\Model\Contact;
24 use Friendica\Model\Item;
25 use Friendica\Model\Notification;
26
27 return [
28         // Empty these tables
29         'cache',
30         'conversation',
31         'pconfig',
32         'photo',
33         'workerqueue',
34         'mail',
35         'post-delivery-data',
36         // Base test config to avoid notice messages
37         'config'  => [
38                 [
39                         'cat' => 'system',
40                         'k'   => 'url',
41                         'v'   => 'http://localhost',
42                 ],
43                 [
44                         'cat' => 'config',
45                         'k'   => 'hostname',
46                         'v'   => 'localhost',
47                 ],
48                 [
49                         'cat' => 'system',
50                         'k'   => 'worker_dont_fork',
51                         'v'   => '1',
52                 ],
53         ],
54         'user'    => [
55                 [
56                         'uid'      => 42,
57                         'username' => 'Test user',
58                         'nickname' => 'selfcontact',
59                         'verified' => 1,
60                         'password' => '$2y$10$DLRNTRmJgKe1cSrFJ5Jb0edCqvXlA9sh/RHdSnfxjbR.04yZRm4Qm',
61                         'theme'    => 'frio',
62                 ],
63         ],
64         'contact' => [
65                 [
66                         'id'      => 42,
67                         'uid'     => 42,
68                         'name'    => 'Self contact',
69                         'nick'    => 'selfcontact',
70                         'self'    => 1,
71                         'nurl'    => 'http://localhost/profile/selfcontact',
72                         'url'     => 'http://localhost/profile/selfcontact',
73                         'about'   => 'User used in tests',
74                         'pending' => 0,
75                         'blocked' => 0,
76                         'rel'     => Contact::FOLLOWER,
77                         'network' => Protocol::DFRN,
78                         'location' => 'DFRN',
79                 ],
80                 // Having the same name and nick allows us to test
81                 // the fallback to api_get_nick() in api_get_user()
82                 [
83                         'id'      => 43,
84                         'uid'     => 0,
85                         'name'    => 'othercontact',
86                         'nick'    => 'othercontact',
87                         'self'    => 0,
88                         'nurl'    => 'http://localhost/profile/othercontact',
89                         'url'     => 'http://localhost/profile/othercontact',
90                         'pending' => 0,
91                         'blocked' => 0,
92                         'rel'     => Contact::NOTHING,
93                         'network' => Protocol::DFRN, 
94                         'location' => 'DFRN',
95                 ],
96                 [
97                         'id'      => 44,
98                         'uid'     => 42,
99                         'name'    => 'Friend contact',
100                         'nick'    => 'friendcontact',
101                         'self'    => 0,
102                         'nurl'    => 'http://localhost/profile/friendcontact',
103                         'url'     => 'http://localhost/profile/friendcontact',
104                         'pending' => 0,
105                         'blocked' => 0,
106                         'rel'     => Contact::SHARING,
107                         'network' => Protocol::DFRN,
108                         'location' => 'DFRN',
109                 ],
110                 [
111                         'id'      => 45,
112                         'uid'     => 0,
113                         'name'    => 'Friend contact',
114                         'nick'    => 'friendcontact',
115                         'self'    => 0,
116                         'nurl'    => 'http://localhost/profile/friendcontact',
117                         'url'     => 'http://localhost/profile/friendcontact',
118                         'pending' => 0,
119                         'blocked' => 0,
120                         'rel'     => Contact::SHARING,
121                         'network' => Protocol::DFRN,
122                         'location' => 'DFRN',
123                 ],
124                 [
125                         'id'      => 46,
126                         'uid'     => 42,
127                         'name'    => 'Mutual contact',
128                         'nick'    => 'mutualcontact',
129                         'self'    => 0,
130                         'nurl'    => 'http://localhost/profile/mutualcontact',
131                         'url'     => 'http://localhost/profile/mutualcontact',
132                         'pending' => 0,
133                         'blocked' => 0,
134                         'rel'     => Contact::FRIEND,
135                         'network' => Protocol::DFRN,
136                         'location' => 'DFRN',
137                 ],
138                 [
139                         'id'      => 47,
140                         'uid'     => 0,
141                         'name'    => 'Mutual contact',
142                         'nick'    => 'mutualcontact',
143                         'self'    => 0,
144                         'nurl'    => 'http://localhost/profile/mutualcontact',
145                         'url'     => 'http://localhost/profile/mutualcontact',
146                         'pending' => 0,
147                         'blocked' => 0,
148                         'rel'     => Contact::SHARING,
149                         'network' => Protocol::DFRN,
150                         'location' => 'DFRN',
151                 ],
152         ],
153         'item-uri'    => [
154                 [
155                         'id'   => 1,
156                         'uri'  => '1',
157                         'guid' => '1',
158                 ],
159                 [
160                         'id'   => 2,
161                         'uri'  => '2',
162                         'guid' => '2',
163                 ],
164                 [
165                         'id'   => 3,
166                         'uri'  => '3',
167                         'guid' => '3',
168                 ],
169                 [
170                         'id'   => 4,
171                         'uri'  => '4',
172                         'guid' => '4',
173                 ],
174                 [
175                         'id'   => 5,
176                         'uri'  => '5',
177                         'guid' => '5',
178                 ],
179                 [
180                         'id'   => 6,
181                         'uri'  => '6',
182                         'guid' => '6',
183                 ],
184         ],
185         'post-content' => [
186                 [
187                         'uri-id' => 1,
188                         'body'   => 'Parent status',
189                         'plink'  => 'http://localhost/display/1',
190                 ],
191                 [
192                         'uri-id' => 2,
193                         'body'   => 'Reply',
194                         'plink'  => 'http://localhost/display/2',
195                 ],
196                 [
197                         'uri-id' => 3,
198                         'body'   => 'Other user status',
199                         'plink'  => 'http://localhost/display/3',
200                 ],
201                 [
202                         'uri-id' => 4,
203                         'body'   => 'Friend user reply',
204                         'plink'  => 'http://localhost/display/4',
205                 ],
206                 [
207                         'uri-id' => 5,
208                         'body'   => '[share]Shared status[/share]',
209                         'plink'  => 'http://localhost/display/5',
210                 ],
211                 [
212                         'uri-id' => 6,
213                         'body'   => 'Friend user status',
214                         'plink'  => 'http://localhost/display/6',
215                 ],
216         ],
217         'post-thread'  => [
218                 [
219                         'uri-id'     => 1,
220                         'author-id'  => 42,
221                         'owner-id'   => 42,
222                         'causer-id'  => 42,
223                         'network' => Protocol::DFRN,
224                 ],
225                 [
226                         'uri-id'     => 3,
227                         'author-id'  => 43,
228                         'owner-id'   => 43,
229                         'causer-id'  => 43,
230                         'network' => Protocol::DFRN,
231                 ],
232                 [
233                         'uri-id'     => 6,
234                         'author-id'  => 44,
235                         'owner-id'   => 44,
236                         'causer-id'  => 44,
237                         'network' => Protocol::DFRN,
238                 ],
239         ],
240         'post-thread-user'  => [
241                 [
242                         'uri-id'     => 1,
243                         'uid'        => 42,
244                         'wall'       => 1,
245                 ],
246                 [
247                         'uri-id'     => 3,
248                         'uid'        => 42,
249                         'wall'       => 1,
250                 ],
251                 [
252                         'uri-id'     => 6,
253                         'uid'        => 42,
254                         'wall'       => 1,
255                 ],
256         ],
257         'post-user' => [
258                 [
259                         'id'          => 1,
260                         'uri-id'      => 1,
261                         'uid'         => 42,
262                         'contact-id'  => 42,
263                         'unseen'      => 1,
264                         'origin'      => 1,
265                 ],
266                 [
267                         'id'          => 2,
268                         'uri-id'      => 2,
269                         'uid'         => 42,
270                         'contact-id'  => 42,
271                         'unseen'      => 0,
272                         'origin'      => 1,
273                 ],
274                 [
275                         'id'          => 3,
276                         'uri-id'      => 3,
277                         'uid'         => 42,
278                         'contact-id'  => 43,
279                         'unseen'      => 0,
280                         'origin'      => 1,
281                 ],
282                 [
283                         'id'          => 4,
284                         'uri-id'      => 4,
285                         'uid'         => 42,
286                         'contact-id'  => 44,
287                         'unseen'      => 0,
288                         'origin'      => 1,
289                 ],
290                 [
291                         'id'          => 5,
292                         'uri-id'      => 5,
293                         'uid'         => 42,
294                         'contact-id'  => 42,
295                         'unseen'      => 0,
296                         'origin'      => 1,
297                 ],
298                 [
299                         'id'          => 6,
300                         'uri-id'      => 6,
301                         'uid'         => 42,
302                         'contact-id'  => 44,
303                         'unseen'      => 0,
304                         'origin'      => 1,
305                 ],
306
307         ],
308         'item'    => [
309                 [
310                         'id'          => 1,
311                         'uri-id'      => 1,
312                         'uri'         => '1',
313                         'visible'     => 1,
314                         'contact-id'  => 42,
315                         'author-id'   => 42,
316                         'owner-id'    => 42,
317                         'causer-id'   => 42,
318                         'uid'         => 42,
319                         'verb'        => 'http://activitystrea.ms/schema/1.0/post',
320                         'unseen'      => 1,
321                         'parent'      => 1,
322                         'parent-uri-id' => 1,
323                         'parent-uri'  => '1',
324                         'thr-parent-id' => 1,
325                         'thr-parent'  => '1',
326                         'private'     => Item::PUBLIC,
327                         'gravity'     => GRAVITY_PARENT,
328                         'author-link' => 'http://localhost/profile/selfcontact',
329                         'wall'        => 1,
330                         'starred'     => 1,
331                         'origin'      => 1,
332                         'allow_cid'   => '',
333                         'allow_gid'   => '',
334                         'deny_cid'    => '',
335                         'deny_gid'    => '',
336                         'guid'        => '1',
337                 ],
338                 [
339                         'id'          => 2,
340                         'uri-id'      => 2,
341                         'uri'         => '2',
342                         'visible'     => 1,
343                         'contact-id'  => 42,
344                         'author-id'   => 42,
345                         'owner-id'    => 42,
346                         'causer-id'   => 42,
347                         'uid'         => 42,
348                         'verb'        => 'http://activitystrea.ms/schema/1.0/post',
349                         'unseen'      => 0,
350                         'parent'      => 1,
351                         'parent-uri-id' => 1,
352                         'parent-uri'  => '1',
353                         'thr-parent-id' => 1,
354                         'thr-parent'  => '1',
355                         'private'     => Item::PUBLIC,
356                         'gravity'     => GRAVITY_COMMENT,
357                         'author-link' => 'http://localhost/profile/selfcontact',
358                         'wall'        => 1,
359                         'starred'     => 0,
360                         'origin'      => 1,
361                         'guid'        => '2',
362                 ],
363                 [
364                         'id'          => 3,
365                         'uri-id'      => 3,
366                         'uri'         => '3',
367                         'visible'     => 1,
368                         'contact-id'  => 43,
369                         'author-id'   => 43,
370                         'owner-id'    => 42,
371                         'causer-id'   => 43,
372                         'uid'         => 42,
373                         'verb'        => 'http://activitystrea.ms/schema/1.0/post',
374                         'unseen'      => 0,
375                         'parent'      => 3,
376                         'parent-uri-id' => 3,
377                         'parent-uri'  => '3',
378                         'thr-parent-id' => 3,
379                         'thr-parent'  => '3',
380                         'private'     => Item::PUBLIC,
381                         'gravity'     => GRAVITY_PARENT,
382                         'author-link' => 'http://localhost/profile/othercontact',
383                         'wall'        => 1,
384                         'starred'     => 0,
385                         'origin'      => 1,
386                         'guid'        => '3',
387                 ],
388                 [
389                         'id'          => 4,
390                         'uri-id'      => 4,
391                         'uri'         => '4',
392                         'visible'     => 1,
393                         'contact-id'  => 44,
394                         'author-id'   => 44,
395                         'owner-id'    => 42,
396                         'causer-id'   => 44,
397                         'uid'         => 42,
398                         'verb'        => 'http://activitystrea.ms/schema/1.0/post',
399                         'unseen'      => 0,
400                         'body'        => 'Friend user reply',
401                         'parent'      => 1,
402                         'parent-uri-id' => 1,
403                         'parent-uri'  => '1',
404                         'thr-parent-id' => 1,
405                         'thr-parent'  => '1',
406                         'private'     => Item::PUBLIC,
407                         'gravity'     => GRAVITY_COMMENT,
408                         'author-link' => 'http://localhost/profile/othercontact',
409                         'wall'        => 1,
410                         'starred'     => 0,
411                         'origin'      => 1,
412                         'guid'        => '4',
413                 ],
414                 [
415
416                         'id'          => 5,
417                         'uri-id'      => 5,
418                         'uri'         => '5',
419                         'visible'     => 1,
420                         'contact-id'  => 42,
421                         'author-id'   => 42,
422                         'owner-id'    => 42,
423                         'causer-id'   => 42,
424                         'uid'         => 42,
425                         'verb'        => 'http://activitystrea.ms/schema/1.0/post',
426                         'unseen'      => 0,
427                         'parent'      => 1,
428                         'parent-uri-id' => 1,
429                         'parent-uri'  => '1',
430                         'thr-parent-id' => 1,
431                         'thr-parent'  => '1',
432                         'private'     => Item::PUBLIC,
433                         'gravity'     => GRAVITY_COMMENT,
434                         'author-link' => 'http://localhost/profile/othercontact',
435                         'wall'        => 1,
436                         'starred'     => 0,
437                         'origin'      => 1,
438                         'allow_cid'   => '',
439                         'allow_gid'   => '',
440                         'deny_cid'    => '',
441                         'deny_gid'    => '',
442                         'guid'        => '5',
443                 ],
444                 [
445                         'id'          => 6,
446                         'uri-id'      => 6,
447                         'uri'         => '6',
448                         'visible'     => 1,
449                         'contact-id'  => 44,
450                         'author-id'   => 44,
451                         'owner-id'    => 42,
452                         'causer-id'   => 44,
453                         'uid'         => 42,
454                         'verb'        => 'http://activitystrea.ms/schema/1.0/post',
455                         'unseen'      => 0,
456                         'parent'      => 6,
457                         'parent-uri-id' => 6,
458                         'parent-uri'  => '6',
459                         'thr-parent-id' => 6,
460                         'thr-parent'  => '6',
461                         'private'     => Item::PUBLIC,
462                         'gravity'     => GRAVITY_PARENT,
463                         'author-link' => 'http://localhost/profile/othercontact',
464                         'wall'        => 1,
465                         'starred'     => 0,
466                         'origin'      => 1,
467                         'guid'        => '6',
468                 ],
469         ],
470         'notify' => [
471                 [
472                         'id' => 1,
473                         'type' => 8,
474                         'name' => 'Reply to',
475                         'url' => 'http://localhost/display/1',
476                         'photo' => 'http://localhost/',
477                         'date' => '2020-01-01 12:12:02',
478                         'msg' => 'A test reply from an item',
479                         'uid' => 42,
480                         'link' => 'http://localhost/notification/1',
481                         'iid' => 4,
482                         'seen' => 0,
483                         'verb' => '',
484                         'otype' => Notification\ObjectType::ITEM,
485                         'name_cache' => 'Reply to',
486                         'msg_cache' => 'A test reply from an item',
487                 ],
488         ],
489         'profile' => [
490                 [
491                         'id' => 1,
492                         'uid' => 42,
493                 ],
494         ],
495         'group'   => [
496                 [
497                         'id'      => 1,
498                         'uid'     => 42,
499                         'visible' => 1,
500                         'name'    => 'Visible list',
501                 ],
502                 [
503                         'id'      => 2,
504                         'uid'     => 42,
505                         'visible' => 0,
506                         'name'    => 'Private list',
507                 ],
508         ],
509         'search'  => [
510                 [
511                         'id'   => 1,
512                         'term' => 'Saved search',
513                         'uid'  => 42,
514                 ],
515         ],
516 ];