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