]> git.mxchange.org Git - friendica.git/blob - tests/datasets/api.fixture.php
Merge pull request #9921 from annando/issue-9906
[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-user' => [
241                 [
242                         'id'          => 1,
243                         'uri-id'      => 1,
244                         'uid'         => 42,
245                         'contact-id'  => 42,
246                         'unseen'      => 1,
247                         'origin'      => 1,
248                 ],
249                 [
250                         'id'          => 2,
251                         'uri-id'      => 2,
252                         'uid'         => 42,
253                         'contact-id'  => 42,
254                         'unseen'      => 0,
255                         'origin'      => 1,
256                 ],
257                 [
258                         'id'          => 3,
259                         'uri-id'      => 3,
260                         'uid'         => 42,
261                         'contact-id'  => 43,
262                         'unseen'      => 0,
263                         'origin'      => 1,
264                 ],
265                 [
266                         'id'          => 4,
267                         'uri-id'      => 4,
268                         'uid'         => 42,
269                         'contact-id'  => 44,
270                         'unseen'      => 0,
271                         'origin'      => 1,
272                 ],
273                 [
274                         'id'          => 5,
275                         'uri-id'      => 5,
276                         'uid'         => 42,
277                         'contact-id'  => 42,
278                         'unseen'      => 0,
279                         'origin'      => 1,
280                 ],
281                 [
282                         'id'          => 6,
283                         'uri-id'      => 6,
284                         'uid'         => 42,
285                         'contact-id'  => 44,
286                         'unseen'      => 0,
287                         'origin'      => 1,
288                 ],
289                 [
290                         'id'          => 7,
291                         'uri-id'      => 1,
292                         'uid'         => 0,
293                         'contact-id'  => 42,
294                         'unseen'      => 1,
295                         'origin'      => 0,
296                 ],
297                 [
298                         'id'          => 8,
299                         'uri-id'      => 2,
300                         'uid'         => 0,
301                         'contact-id'  => 42,
302                         'unseen'      => 0,
303                         'origin'      => 0,
304                 ],
305                 [
306                         'id'          => 9,
307                         'uri-id'      => 3,
308                         'uid'         => 0,
309                         'contact-id'  => 43,
310                         'unseen'      => 0,
311                         'origin'      => 0,
312                 ],
313                 [
314                         'id'          => 10,
315                         'uri-id'      => 4,
316                         'uid'         => 0,
317                         'contact-id'  => 44,
318                         'unseen'      => 0,
319                         'origin'      => 0,
320                 ],
321                 [
322                         'id'          => 11,
323                         'uri-id'      => 5,
324                         'uid'         => 0,
325                         'contact-id'  => 42,
326                         'unseen'      => 0,
327                         'origin'      => 0,
328                 ],
329                 [
330                         'id'          => 12,
331                         'uri-id'      => 6,
332                         'uid'         => 0,
333                         'contact-id'  => 44,
334                         'unseen'      => 0,
335                         'origin'      => 0,
336                 ],
337         ],
338         'post-thread-user'  => [
339                 [
340                         'uri-id'     => 1,
341                         'uid'        => 42,
342                         'wall'       => 1,
343                         'post-user-id' => 1,
344                 ],
345                 [
346                         'uri-id'     => 3,
347                         'uid'        => 42,
348                         'wall'       => 1,
349                         'post-user-id' => 3,
350                 ],
351                 [
352                         'uri-id'     => 6,
353                         'uid'        => 42,
354                         'wall'       => 1,
355                         'post-user-id' => 6,
356                 ],
357                 [
358                         'uri-id'     => 1,
359                         'uid'        => 0,
360                         'wall'       => 0,
361                         'post-user-id' => 7,
362                 ],
363                 [
364                         'uri-id'     => 3,
365                         'uid'        => 0,
366                         'wall'       => 0,
367                         'post-user-id' => 9,
368                 ],
369                 [
370                         'uri-id'     => 6,
371                         'uid'        => 0,
372                         'wall'       => 0,
373                         'post-user-id' => 12,
374                 ],
375         ],
376         'item'    => [
377                 [
378                         'id'          => 1,
379                         'uri-id'      => 1,
380                         'uri'         => '1',
381                         'visible'     => 1,
382                         'contact-id'  => 42,
383                         'author-id'   => 42,
384                         'owner-id'    => 42,
385                         'causer-id'   => 42,
386                         'uid'         => 42,
387                         'verb'        => 'http://activitystrea.ms/schema/1.0/post',
388                         'unseen'      => 1,
389                         'parent'      => 1,
390                         'parent-uri-id' => 1,
391                         'parent-uri'  => '1',
392                         'thr-parent-id' => 1,
393                         'thr-parent'  => '1',
394                         'private'     => Item::PUBLIC,
395                         'gravity'     => GRAVITY_PARENT,
396                         'author-link' => 'http://localhost/profile/selfcontact',
397                         'wall'        => 1,
398                         'starred'     => 1,
399                         'origin'      => 1,
400                         'allow_cid'   => '',
401                         'allow_gid'   => '',
402                         'deny_cid'    => '',
403                         'deny_gid'    => '',
404                         'guid'        => '1',
405                 ],
406                 [
407                         'id'          => 2,
408                         'uri-id'      => 2,
409                         'uri'         => '2',
410                         'visible'     => 1,
411                         'contact-id'  => 42,
412                         'author-id'   => 42,
413                         'owner-id'    => 42,
414                         'causer-id'   => 42,
415                         'uid'         => 42,
416                         'verb'        => 'http://activitystrea.ms/schema/1.0/post',
417                         'unseen'      => 0,
418                         'parent'      => 1,
419                         'parent-uri-id' => 1,
420                         'parent-uri'  => '1',
421                         'thr-parent-id' => 1,
422                         'thr-parent'  => '1',
423                         'private'     => Item::PUBLIC,
424                         'gravity'     => GRAVITY_COMMENT,
425                         'author-link' => 'http://localhost/profile/selfcontact',
426                         'wall'        => 1,
427                         'starred'     => 0,
428                         'origin'      => 1,
429                         'guid'        => '2',
430                 ],
431                 [
432                         'id'          => 3,
433                         'uri-id'      => 3,
434                         'uri'         => '3',
435                         'visible'     => 1,
436                         'contact-id'  => 43,
437                         'author-id'   => 43,
438                         'owner-id'    => 42,
439                         'causer-id'   => 43,
440                         'uid'         => 42,
441                         'verb'        => 'http://activitystrea.ms/schema/1.0/post',
442                         'unseen'      => 0,
443                         'parent'      => 3,
444                         'parent-uri-id' => 3,
445                         'parent-uri'  => '3',
446                         'thr-parent-id' => 3,
447                         'thr-parent'  => '3',
448                         'private'     => Item::PUBLIC,
449                         'gravity'     => GRAVITY_PARENT,
450                         'author-link' => 'http://localhost/profile/othercontact',
451                         'wall'        => 1,
452                         'starred'     => 0,
453                         'origin'      => 1,
454                         'guid'        => '3',
455                 ],
456                 [
457                         'id'          => 4,
458                         'uri-id'      => 4,
459                         'uri'         => '4',
460                         'visible'     => 1,
461                         'contact-id'  => 44,
462                         'author-id'   => 44,
463                         'owner-id'    => 42,
464                         'causer-id'   => 44,
465                         'uid'         => 42,
466                         'verb'        => 'http://activitystrea.ms/schema/1.0/post',
467                         'unseen'      => 0,
468                         'body'        => 'Friend user reply',
469                         'parent'      => 1,
470                         'parent-uri-id' => 1,
471                         'parent-uri'  => '1',
472                         'thr-parent-id' => 1,
473                         'thr-parent'  => '1',
474                         'private'     => Item::PUBLIC,
475                         'gravity'     => GRAVITY_COMMENT,
476                         'author-link' => 'http://localhost/profile/othercontact',
477                         'wall'        => 1,
478                         'starred'     => 0,
479                         'origin'      => 1,
480                         'guid'        => '4',
481                 ],
482                 [
483
484                         'id'          => 5,
485                         'uri-id'      => 5,
486                         'uri'         => '5',
487                         'visible'     => 1,
488                         'contact-id'  => 42,
489                         'author-id'   => 42,
490                         'owner-id'    => 42,
491                         'causer-id'   => 42,
492                         'uid'         => 42,
493                         'verb'        => 'http://activitystrea.ms/schema/1.0/post',
494                         'unseen'      => 0,
495                         'parent'      => 1,
496                         'parent-uri-id' => 1,
497                         'parent-uri'  => '1',
498                         'thr-parent-id' => 1,
499                         'thr-parent'  => '1',
500                         'private'     => Item::PUBLIC,
501                         'gravity'     => GRAVITY_COMMENT,
502                         'author-link' => 'http://localhost/profile/othercontact',
503                         'wall'        => 1,
504                         'starred'     => 0,
505                         'origin'      => 1,
506                         'allow_cid'   => '',
507                         'allow_gid'   => '',
508                         'deny_cid'    => '',
509                         'deny_gid'    => '',
510                         'guid'        => '5',
511                 ],
512                 [
513                         'id'          => 6,
514                         'uri-id'      => 6,
515                         'uri'         => '6',
516                         'visible'     => 1,
517                         'contact-id'  => 44,
518                         'author-id'   => 44,
519                         'owner-id'    => 42,
520                         'causer-id'   => 44,
521                         'uid'         => 42,
522                         'verb'        => 'http://activitystrea.ms/schema/1.0/post',
523                         'unseen'      => 0,
524                         'parent'      => 6,
525                         'parent-uri-id' => 6,
526                         'parent-uri'  => '6',
527                         'thr-parent-id' => 6,
528                         'thr-parent'  => '6',
529                         'private'     => Item::PUBLIC,
530                         'gravity'     => GRAVITY_PARENT,
531                         'author-link' => 'http://localhost/profile/othercontact',
532                         'wall'        => 1,
533                         'starred'     => 0,
534                         'origin'      => 1,
535                         'guid'        => '6',
536                 ],
537                 [
538                         'id'          => 7,
539                         'uri-id'      => 1,
540                         'uri'         => '1',
541                         'visible'     => 1,
542                         'contact-id'  => 42,
543                         'author-id'   => 42,
544                         'owner-id'    => 42,
545                         'causer-id'   => 42,
546                         'uid'         => 0,
547                         'verb'        => 'http://activitystrea.ms/schema/1.0/post',
548                         'unseen'      => 1,
549                         'parent'      => 7,
550                         'parent-uri-id' => 1,
551                         'parent-uri'  => '1',
552                         'thr-parent-id' => 1,
553                         'thr-parent'  => '1',
554                         'private'     => Item::PUBLIC,
555                         'gravity'     => GRAVITY_PARENT,
556                         'author-link' => 'http://localhost/profile/selfcontact',
557                         'wall'        => 0,
558                         'starred'     => 1,
559                         'origin'      => 0,
560                         'allow_cid'   => '',
561                         'allow_gid'   => '',
562                         'deny_cid'    => '',
563                         'deny_gid'    => '',
564                         'guid'        => '1',
565                 ],
566                 [
567                         'id'          => 8,
568                         'uri-id'      => 2,
569                         'uri'         => '2',
570                         'visible'     => 1,
571                         'contact-id'  => 42,
572                         'author-id'   => 42,
573                         'owner-id'    => 42,
574                         'causer-id'   => 42,
575                         'uid'         => 0,
576                         'verb'        => 'http://activitystrea.ms/schema/1.0/post',
577                         'unseen'      => 0,
578                         'parent'      => 7,
579                         'parent-uri-id' => 1,
580                         'parent-uri'  => '1',
581                         'thr-parent-id' => 1,
582                         'thr-parent'  => '1',
583                         'private'     => Item::PUBLIC,
584                         'gravity'     => GRAVITY_COMMENT,
585                         'author-link' => 'http://localhost/profile/selfcontact',
586                         'wall'        => 0,
587                         'starred'     => 0,
588                         'origin'      => 0,
589                         'guid'        => '2',
590                 ],
591                 [
592                         'id'          => 9,
593                         'uri-id'      => 3,
594                         'uri'         => '3',
595                         'visible'     => 1,
596                         'contact-id'  => 43,
597                         'author-id'   => 43,
598                         'owner-id'    => 42,
599                         'causer-id'   => 43,
600                         'uid'         => 0,
601                         'verb'        => 'http://activitystrea.ms/schema/1.0/post',
602                         'unseen'      => 0,
603                         'parent'      => 9,
604                         'parent-uri-id' => 3,
605                         'parent-uri'  => '3',
606                         'thr-parent-id' => 3,
607                         'thr-parent'  => '3',
608                         'private'     => Item::PUBLIC,
609                         'gravity'     => GRAVITY_PARENT,
610                         'author-link' => 'http://localhost/profile/othercontact',
611                         'wall'        => 0,
612                         'starred'     => 0,
613                         'origin'      => 0,
614                         'guid'        => '3',
615                 ],
616                 [
617                         'id'          => 10,
618                         'uri-id'      => 4,
619                         'uri'         => '4',
620                         'visible'     => 1,
621                         'contact-id'  => 44,
622                         'author-id'   => 44,
623                         'owner-id'    => 42,
624                         'causer-id'   => 44,
625                         'uid'         => 0,
626                         'verb'        => 'http://activitystrea.ms/schema/1.0/post',
627                         'unseen'      => 0,
628                         'body'        => 'Friend user reply',
629                         'parent'      => 7,
630                         'parent-uri-id' => 1,
631                         'parent-uri'  => '1',
632                         'thr-parent-id' => 1,
633                         'thr-parent'  => '1',
634                         'private'     => Item::PUBLIC,
635                         'gravity'     => GRAVITY_COMMENT,
636                         'author-link' => 'http://localhost/profile/othercontact',
637                         'wall'        => 0,
638                         'starred'     => 0,
639                         'origin'      => 0,
640                         'guid'        => '4',
641                 ],
642                 [
643
644                         'id'          => 11,
645                         'uri-id'      => 5,
646                         'uri'         => '5',
647                         'visible'     => 1,
648                         'contact-id'  => 42,
649                         'author-id'   => 42,
650                         'owner-id'    => 42,
651                         'causer-id'   => 42,
652                         'uid'         => 0,
653                         'verb'        => 'http://activitystrea.ms/schema/1.0/post',
654                         'unseen'      => 0,
655                         'parent'      => 7,
656                         'parent-uri-id' => 1,
657                         'parent-uri'  => '1',
658                         'thr-parent-id' => 1,
659                         'thr-parent'  => '1',
660                         'private'     => Item::PUBLIC,
661                         'gravity'     => GRAVITY_COMMENT,
662                         'author-link' => 'http://localhost/profile/othercontact',
663                         'wall'        => 0,
664                         'starred'     => 0,
665                         'origin'      => 1,
666                         'allow_cid'   => '',
667                         'allow_gid'   => '',
668                         'deny_cid'    => '',
669                         'deny_gid'    => '',
670                         'guid'        => '5',
671                 ],
672                 [
673                         'id'          => 12,
674                         'uri-id'      => 6,
675                         'uri'         => '6',
676                         'visible'     => 1,
677                         'contact-id'  => 44,
678                         'author-id'   => 44,
679                         'owner-id'    => 42,
680                         'causer-id'   => 44,
681                         'uid'         => 0,
682                         'verb'        => 'http://activitystrea.ms/schema/1.0/post',
683                         'unseen'      => 0,
684                         'parent'      => 12,
685                         'parent-uri-id' => 6,
686                         'parent-uri'  => '6',
687                         'thr-parent-id' => 6,
688                         'thr-parent'  => '6',
689                         'private'     => Item::PUBLIC,
690                         'gravity'     => GRAVITY_PARENT,
691                         'author-link' => 'http://localhost/profile/othercontact',
692                         'wall'        => 0,
693                         'starred'     => 0,
694                         'origin'      => 0,
695                         'guid'        => '6',
696                 ],
697         ],
698         'notify' => [
699                 [
700                         'id' => 1,
701                         'type' => 8,
702                         'name' => 'Reply to',
703                         'url' => 'http://localhost/display/1',
704                         'photo' => 'http://localhost/',
705                         'date' => '2020-01-01 12:12:02',
706                         'msg' => 'A test reply from an item',
707                         'uid' => 42,
708                         'link' => 'http://localhost/notification/1',
709                         'iid' => 4,
710                         'seen' => 0,
711                         'verb' => '',
712                         'otype' => Notification\ObjectType::ITEM,
713                         'name_cache' => 'Reply to',
714                         'msg_cache' => 'A test reply from an item',
715                 ],
716         ],
717         'profile' => [
718                 [
719                         'id' => 1,
720                         'uid' => 42,
721                 ],
722         ],
723         'group'   => [
724                 [
725                         'id'      => 1,
726                         'uid'     => 42,
727                         'visible' => 1,
728                         'name'    => 'Visible list',
729                 ],
730                 [
731                         'id'      => 2,
732                         'uid'     => 42,
733                         'visible' => 0,
734                         'name'    => 'Private list',
735                 ],
736         ],
737         'search'  => [
738                 [
739                         'id'   => 1,
740                         'term' => 'Saved search',
741                         'uid'  => 42,
742                 ],
743         ],
744 ];