]> git.mxchange.org Git - friendica.git/blob - tests/datasets/api.fixture.php
ca54ff0a9dcdb534ceecd1cdba63a6651b426658
[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                         'cat' => 'system',
55                         'k'   => 'curl_timeout',
56                         'v'   => '1',
57                 ],
58                 [
59                         'cat' => 'system',
60                         'k'   => 'xrd_timeout',
61                         'v'   => '1',
62                 ],
63         ],
64         'user'    => [
65                 [
66                         'uid'      => 42,
67                         'username' => 'Test user',
68                         'nickname' => 'selfcontact',
69                         'verified' => 1,
70                         'password' => '$2y$10$DLRNTRmJgKe1cSrFJ5Jb0edCqvXlA9sh/RHdSnfxjbR.04yZRm4Qm',
71                         'theme'    => 'frio',
72                 ],
73         ],
74         'contact' => [
75                 [
76                         'id'      => 42,
77                         'uid'     => 42,
78                         'name'    => 'Self contact',
79                         'nick'    => 'selfcontact',
80                         'self'    => 1,
81                         'nurl'    => 'http://localhost/profile/selfcontact',
82                         'url'     => 'http://localhost/profile/selfcontact',
83                         'about'   => 'User used in tests',
84                         'pending' => 0,
85                         'blocked' => 0,
86                         'rel'     => Contact::FOLLOWER,
87                         'network' => Protocol::DFRN,
88                         'location' => 'DFRN',
89                 ],
90                 // Having the same name and nick allows us to test
91                 // the fallback to api_get_nick() in api_get_user()
92                 [
93                         'id'      => 43,
94                         'uid'     => 0,
95                         'name'    => 'othercontact',
96                         'nick'    => 'othercontact',
97                         'self'    => 0,
98                         'nurl'    => 'http://localhost/profile/othercontact',
99                         'url'     => 'http://localhost/profile/othercontact',
100                         'pending' => 0,
101                         'blocked' => 0,
102                         'rel'     => Contact::NOTHING,
103                         'network' => Protocol::DFRN, 
104                         'location' => 'DFRN',
105                 ],
106                 [
107                         'id'      => 44,
108                         'uid'     => 42,
109                         'name'    => 'Friend contact',
110                         'nick'    => 'friendcontact',
111                         'self'    => 0,
112                         'nurl'    => 'http://localhost/profile/friendcontact',
113                         'url'     => 'http://localhost/profile/friendcontact',
114                         'pending' => 0,
115                         'blocked' => 0,
116                         'rel'     => Contact::SHARING,
117                         'network' => Protocol::DFRN,
118                         'location' => 'DFRN',
119                 ],
120                 [
121                         'id'      => 45,
122                         'uid'     => 0,
123                         'name'    => 'Friend contact',
124                         'nick'    => 'friendcontact',
125                         'self'    => 0,
126                         'nurl'    => 'http://localhost/profile/friendcontact',
127                         'url'     => 'http://localhost/profile/friendcontact',
128                         'pending' => 0,
129                         'blocked' => 0,
130                         'rel'     => Contact::SHARING,
131                         'network' => Protocol::DFRN,
132                         'location' => 'DFRN',
133                 ],
134                 [
135                         'id'      => 46,
136                         'uid'     => 42,
137                         'name'    => 'Mutual contact',
138                         'nick'    => 'mutualcontact',
139                         'self'    => 0,
140                         'nurl'    => 'http://localhost/profile/mutualcontact',
141                         'url'     => 'http://localhost/profile/mutualcontact',
142                         'pending' => 0,
143                         'blocked' => 0,
144                         'rel'     => Contact::FRIEND,
145                         'network' => Protocol::DFRN,
146                         'location' => 'DFRN',
147                 ],
148                 [
149                         'id'      => 47,
150                         'uid'     => 0,
151                         'name'    => 'Mutual contact',
152                         'nick'    => 'mutualcontact',
153                         'self'    => 0,
154                         'nurl'    => 'http://localhost/profile/mutualcontact',
155                         'url'     => 'http://localhost/profile/mutualcontact',
156                         'pending' => 0,
157                         'blocked' => 0,
158                         'rel'     => Contact::SHARING,
159                         'network' => Protocol::DFRN,
160                         'location' => 'DFRN',
161                 ],
162         ],
163         'item-uri'    => [
164                 [
165                         'id'   => 1,
166                         'uri'  => '1',
167                         'guid' => '1',
168                 ],
169                 [
170                         'id'   => 2,
171                         'uri'  => '2',
172                         'guid' => '2',
173                 ],
174                 [
175                         'id'   => 3,
176                         'uri'  => '3',
177                         'guid' => '3',
178                 ],
179                 [
180                         'id'   => 4,
181                         'uri'  => '4',
182                         'guid' => '4',
183                 ],
184                 [
185                         'id'   => 5,
186                         'uri'  => '5',
187                         'guid' => '5',
188                 ],
189                 [
190                         'id'   => 6,
191                         'uri'  => '6',
192                         'guid' => '6',
193                 ],
194         ],
195         'verb'    => [
196                 [
197                         'id'   => 0,
198                         'name' => '',
199                 ],
200                 [
201                         'id'   => 1,
202                         'name' => 'http://activitystrea.ms/schema/1.0/like',
203                 ],
204                 [
205                         'id'   => 2,
206                         'name' => 'http://purl.org/macgirvin/dfrn/1.0/dislike',
207                 ],
208                 [
209                         'id'   => 3,
210                         'name' => 'http://purl.org/zot/activity/attendyes',
211                 ],
212                 [
213                         'id'   => 4,
214                         'name' => 'http://purl.org/zot/activity/attendno',
215                 ],
216                 [
217                         'id'   => 5,
218                         'name' => 'http://purl.org/zot/activity/attendmaybe',
219                 ],
220                 [
221                         'id'   => 6,
222                         'name' => 'http://activitystrea.ms/schema/1.0/follow',
223                 ],
224                 [
225                         'id'   => 7,
226                         'name' => 'https://www.w3.org/ns/activitystreams#Announce',
227                 ],
228                 [
229                         'id'   => 8,
230                         'name' => 'http://activitystrea.ms/schema/1.0/post',
231                 ],
232         ],
233         'post-content' => [
234                 [
235                         'uri-id' => 1,
236                         'body'   => 'Parent status',
237                         'plink'  => 'http://localhost/display/1',
238                 ],
239                 [
240                         'uri-id' => 2,
241                         'body'   => 'Reply',
242                         'plink'  => 'http://localhost/display/2',
243                 ],
244                 [
245                         'uri-id' => 3,
246                         'body'   => 'Other user status',
247                         'plink'  => 'http://localhost/display/3',
248                 ],
249                 [
250                         'uri-id' => 4,
251                         'body'   => 'Friend user reply',
252                         'plink'  => 'http://localhost/display/4',
253                 ],
254                 [
255                         'uri-id' => 5,
256                         'body'   => '[share]Shared status[/share]',
257                         'plink'  => 'http://localhost/display/5',
258                 ],
259                 [
260                         'uri-id' => 6,
261                         'body'   => 'Friend user status',
262                         'plink'  => 'http://localhost/display/6',
263                 ],
264         ],
265         'post'    => [
266                 [
267                         'uri-id'        => 1,
268                         'parent-uri-id' => 1,
269                         'thr-parent-id' => 1,
270                         'gravity'       => GRAVITY_PARENT,
271                         'network'       => Protocol::DFRN,
272                         'owner-id'      => 42,
273                         'author-id'     => 42,
274                         'causer-id'     => 42,
275                         'vid'           => 8,
276                         'private'       => Item::PUBLIC,
277                         'visible'       => 1,
278                         'deleted'       => 0,
279                 ],
280                 [
281                         'uri-id'        => 2,
282                         'parent-uri-id' => 1,
283                         'thr-parent-id' => 1,
284                         'gravity'       => GRAVITY_COMMENT,
285                         'network'       => Protocol::DFRN,
286                         'owner-id'      => 42,
287                         'author-id'     => 42,
288                         'causer-id'     => 42,
289                         'vid'           => 8,
290                         'private'       => Item::PUBLIC,
291                         'visible'       => 1,
292                         'deleted'       => 0,
293                 ],
294                 [
295                         'uri-id'        => 3,
296                         'parent-uri-id' => 3,
297                         'thr-parent-id' => 3,
298                         'gravity'       => GRAVITY_PARENT,
299                         'network'       => Protocol::DFRN,
300                         'owner-id'      => 42,
301                         'author-id'     => 43,
302                         'causer-id'     => 43,
303                         'vid'           => 8,
304                         'private'       => Item::PUBLIC,
305                         'visible'       => 1,
306                         'deleted'       => 0,
307                 ],
308                 [
309                         'uri-id'        => 4,
310                         'parent-uri-id' => 1,
311                         'thr-parent-id' => 1,
312                         'gravity'       => GRAVITY_COMMENT,
313                         'network'       => Protocol::DFRN,
314                         'owner-id'      => 42,
315                         'author-id'     => 44,
316                         'causer-id'     => 44,
317                         'vid'           => 8,
318                         'private'       => Item::PUBLIC,
319                         'visible'       => 1,
320                         'deleted'       => 0,
321                 ],
322                 [
323                         'uri-id'        => 5,
324                         'parent-uri-id' => 1,
325                         'thr-parent-id' => 1,
326                         'gravity'       => GRAVITY_COMMENT,
327                         'network'       => Protocol::DFRN,
328                         'owner-id'      => 42,
329                         'author-id'     => 42,
330                         'causer-id'     => 42,
331                         'vid'           => 8,
332                         'private'       => Item::PUBLIC,
333                         'visible'       => 1,
334                         'deleted'       => 0,
335                 ],
336                 [
337                         'uri-id'        => 6,
338                         'parent-uri-id' => 6,
339                         'thr-parent-id' => 6,
340                         'gravity'       => GRAVITY_PARENT,
341                         'network'       => Protocol::DFRN,
342                         'owner-id'      => 42,
343                         'author-id'     => 44,
344                         'causer-id'     => 44,
345                         'vid'           => 8,
346                         'private'       => Item::PUBLIC,
347                         'visible'       => 1,
348                         'deleted'       => 0,
349                 ],
350         ],
351         'post-user' => [
352                 [
353                         'id'            => 1,
354                         'uri-id'        => 1,
355                         'visible'       => 1,
356                         'contact-id'    => 42,
357                         'author-id'     => 42,
358                         'owner-id'      => 42,
359                         'causer-id'     => 42,
360                         'uid'           => 42,
361                         'vid'           => 8,
362                         'unseen'        => 1,
363                         'parent-uri-id' => 1,
364                         'thr-parent-id' => 1,
365                         'private'       => Item::PUBLIC,
366                         'gravity'       => GRAVITY_PARENT,
367                         'network'       => Protocol::DFRN,
368                         'origin'        => 1,
369                 ],
370                 [
371                         'id'            => 2,
372                         'uri-id'        => 2,
373                         'uid'           => 42,
374                         'contact-id'    => 42,
375                         'unseen'        => 0,
376                         'origin'        => 1,
377                         'parent-uri-id' => 1,
378                         'thr-parent-id' => 1,
379                         'gravity'       => GRAVITY_COMMENT,
380                         'network'       => Protocol::DFRN,
381                         'owner-id'      => 42,
382                         'author-id'     => 42,
383                         'causer-id'     => 42,
384                         'vid'           => 8,
385                         'private'       => Item::PUBLIC,
386                         'visible'       => 1,
387                         'deleted'       => 0,
388                 ],
389                 [
390                         'id'            => 3,
391                         'uri-id'        => 3,
392                         'uid'           => 42,
393                         'contact-id'    => 43,
394                         'unseen'        => 0,
395                         'origin'        => 1,
396                         'parent-uri-id' => 3,
397                         'thr-parent-id' => 3,
398                         'gravity'       => GRAVITY_PARENT,
399                         'network'       => Protocol::DFRN,
400                         'owner-id'      => 42,
401                         'author-id'     => 43,
402                         'causer-id'     => 43,
403                         'vid'           => 8,
404                         'private'       => Item::PUBLIC,
405                         'visible'       => 1,
406                         'deleted'       => 0,
407                 ],
408                 [
409                         'id'            => 4,
410                         'uri-id'        => 4,
411                         'uid'           => 42,
412                         'contact-id'    => 44,
413                         'unseen'        => 0,
414                         'origin'        => 1,
415                         'parent-uri-id' => 1,
416                         'thr-parent-id' => 1,
417                         'gravity'       => GRAVITY_COMMENT,
418                         'network'       => Protocol::DFRN,
419                         'owner-id'      => 42,
420                         'author-id'     => 44,
421                         'causer-id'     => 44,
422                         'vid'           => 8,
423                         'private'       => Item::PUBLIC,
424                         'visible'       => 1,
425                         'deleted'       => 0,
426                 ],
427                 [
428                         'id'            => 5,
429                         'uri-id'        => 5,
430                         'uid'           => 42,
431                         'contact-id'    => 42,
432                         'unseen'        => 0,
433                         'origin'        => 1,
434                         'parent-uri-id' => 1,
435                         'thr-parent-id' => 1,
436                         'gravity'       => GRAVITY_COMMENT,
437                         'network'       => Protocol::DFRN,
438                         'owner-id'      => 42,
439                         'author-id'     => 42,
440                         'causer-id'     => 42,
441                         'vid'           => 8,
442                         'private'       => Item::PUBLIC,
443                         'visible'       => 1,
444                         'deleted'       => 0,
445                 ],
446                 [
447                         'id'            => 6,
448                         'uri-id'        => 6,
449                         'uid'           => 42,
450                         'contact-id'    => 44,
451                         'unseen'        => 0,
452                         'origin'        => 1,
453                         'parent-uri-id' => 6,
454                         'thr-parent-id' => 6,
455                         'gravity'       => GRAVITY_PARENT,
456                         'network'       => Protocol::DFRN,
457                         'owner-id'      => 42,
458                         'author-id'     => 44,
459                         'causer-id'     => 44,
460                         'vid'           => 8,
461                         'private'       => Item::PUBLIC,
462                         'visible'       => 1,
463                         'deleted'       => 0,
464                 ],
465                 [
466                         'id'            => 7,
467                         'uri-id'        => 1,
468                         'uid'           => 0,
469                         'contact-id'    => 42,
470                         'unseen'        => 1,
471                         'origin'        => 0,
472                         'parent-uri-id' => 1,
473                         'thr-parent-id' => 1,
474                         'gravity'       => GRAVITY_PARENT,
475                         'network'       => Protocol::DFRN,
476                         'owner-id'      => 42,
477                         'author-id'     => 42,
478                         'causer-id'     => 42,
479                         'vid'           => 8,
480                         'private'       => Item::PUBLIC,
481                         'visible'       => 1,
482                         'deleted'       => 0,
483                 ],
484                 [
485                         'id'            => 8,
486                         'uri-id'        => 2,
487                         'uid'           => 0,
488                         'contact-id'    => 42,
489                         'unseen'        => 0,
490                         'origin'        => 0,
491                         'parent-uri-id' => 1,
492                         'thr-parent-id' => 1,
493                         'gravity'       => GRAVITY_COMMENT,
494                         'network'       => Protocol::DFRN,
495                         'owner-id'      => 42,
496                         'author-id'     => 42,
497                         'causer-id'     => 42,
498                         'vid'           => 8,
499                         'private'       => Item::PUBLIC,
500                         'visible'       => 1,
501                         'deleted'       => 0,
502                 ],
503                 [
504                         'id'            => 9,
505                         'uri-id'        => 3,
506                         'uid'           => 0,
507                         'contact-id'    => 43,
508                         'unseen'        => 0,
509                         'origin'        => 0,
510                         'parent-uri-id' => 3,
511                         'thr-parent-id' => 3,
512                         'gravity'       => GRAVITY_PARENT,
513                         'network'       => Protocol::DFRN,
514                         'owner-id'      => 42,
515                         'author-id'     => 43,
516                         'causer-id'     => 43,
517                         'vid'           => 8,
518                         'private'       => Item::PUBLIC,
519                         'visible'       => 1,
520                         'deleted'       => 0,
521                 ],
522                 [
523                         'id'            => 10,
524                         'uri-id'        => 4,
525                         'uid'           => 0,
526                         'contact-id'    => 44,
527                         'unseen'        => 0,
528                         'origin'        => 0,
529                         'parent-uri-id' => 1,
530                         'thr-parent-id' => 1,
531                         'gravity'       => GRAVITY_COMMENT,
532                         'network'       => Protocol::DFRN,
533                         'owner-id'      => 42,
534                         'author-id'     => 44,
535                         'causer-id'     => 44,
536                         'vid'           => 8,
537                         'private'       => Item::PUBLIC,
538                         'visible'       => 1,
539                         'deleted'       => 0,
540                 ],
541                 [
542                         'id'            => 11,
543                         'uri-id'        => 5,
544                         'uid'           => 0,
545                         'contact-id'    => 42,
546                         'unseen'        => 0,
547                         'origin'        => 0,
548                         'parent-uri-id' => 1,
549                         'thr-parent-id' => 1,
550                         'gravity'       => GRAVITY_COMMENT,
551                         'network'       => Protocol::DFRN,
552                         'owner-id'      => 42,
553                         'author-id'     => 42,
554                         'causer-id'     => 42,
555                         'vid'           => 8,
556                         'private'       => Item::PUBLIC,
557                         'visible'       => 1,
558                         'deleted'       => 0,
559                 ],
560                 [
561                         'id'            => 12,
562                         'uri-id'        => 6,
563                         'visible'       => 1,
564                         'contact-id'    => 44,
565                         'author-id'     => 44,
566                         'owner-id'      => 42,
567                         'causer-id'     => 44,
568                         'uid'           => 0,
569                         'vid'           => 8,
570                         'unseen'        => 0,
571                         'parent-uri-id' => 6,
572                         'thr-parent-id' => 6,
573                         'private'       => Item::PUBLIC,
574                         'gravity'       => GRAVITY_PARENT,
575                         'network'       => Protocol::DFRN,
576                         'origin'        => 0,
577                         'deleted'       => 0,
578                 ],
579         ],
580         'post-thread'  => [
581                 [
582                         'uri-id'     => 1,
583                         'author-id'  => 42,
584                         'owner-id'   => 42,
585                         'causer-id'  => 42,
586                         'network'    => Protocol::DFRN,
587                 ],
588                 [
589                         'uri-id'     => 3,
590                         'author-id'  => 43,
591                         'owner-id'   => 43,
592                         'causer-id'  => 43,
593                         'network'    => Protocol::DFRN,
594                 ],
595                 [
596                         'uri-id'     => 6,
597                         'author-id'  => 44,
598                         'owner-id'   => 44,
599                         'causer-id'  => 44,
600                         'network'    => Protocol::DFRN,
601                 ],
602         ],
603         'post-thread-user'  => [
604                 [
605                         'uri-id'     => 1,
606                         'uid'        => 42,
607                         'wall'       => 1,
608                         'post-user-id' => 1,
609                         'author-id'  => 42,
610                         'owner-id'   => 42,
611                         'causer-id'  => 42,
612                         'contact-id' => 42,
613                         'network'    => Protocol::DFRN,
614                         'starred'    => 1,
615                         'origin'     => 1,
616                 ],
617                 [
618                         'uri-id'     => 3,
619                         'uid'        => 42,
620                         'wall'       => 1,
621                         'post-user-id' => 3,
622                         'author-id'  => 43,
623                         'owner-id'   => 43,
624                         'causer-id'  => 43,
625                         'contact-id' => 43,
626                         'network'    => Protocol::DFRN,
627                         'starred'    => 0,
628                         'origin'     => 1,
629                 ],
630                 [
631                         'uri-id'     => 6,
632                         'uid'        => 42,
633                         'wall'       => 1,
634                         'post-user-id' => 6,
635                         'author-id'  => 44,
636                         'owner-id'   => 44,
637                         'causer-id'  => 44,
638                         'contact-id' => 44,
639                         'network'    => Protocol::DFRN,
640                         'starred'    => 0,
641                         'origin'     => 1,
642                 ],
643                 [
644                         'uri-id'     => 1,
645                         'uid'        => 0,
646                         'wall'       => 0,
647                         'post-user-id' => 7,
648                         'author-id'  => 42,
649                         'owner-id'   => 42,
650                         'causer-id'  => 42,
651                         'contact-id' => 42,
652                         'network'    => Protocol::DFRN,
653                         'starred'    => 0,
654                         'origin'     => 0,
655                 ],
656                 [
657                         'uri-id'     => 3,
658                         'uid'        => 0,
659                         'wall'       => 0,
660                         'post-user-id' => 9,
661                         'author-id'  => 43,
662                         'owner-id'   => 43,
663                         'causer-id'  => 43,
664                         'contact-id' => 43,
665                         'network'    => Protocol::DFRN,
666                         'starred'    => 0,
667                         'origin'     => 0,
668                 ],
669                 [
670                         'uri-id'     => 6,
671                         'uid'        => 0,
672                         'wall'       => 0,
673                         'post-user-id' => 12,
674                         'author-id'  => 44,
675                         'owner-id'   => 44,
676                         'causer-id'  => 44,
677                         'contact-id' => 44,
678                         'network'    => Protocol::DFRN,
679                         'starred'    => 0,
680                         'origin'     => 0,
681                 ],
682         ],
683         'notify' => [
684                 [
685                         'id' => 1,
686                         'type' => 8,
687                         'name' => 'Reply to',
688                         'url' => 'http://localhost/display/1',
689                         'photo' => 'http://localhost/',
690                         'date' => '2020-01-01 12:12:02',
691                         'msg' => 'A test reply from an item',
692                         'uid' => 42,
693                         'link' => 'http://localhost/notification/1',
694                         'iid' => 4,
695                         'seen' => 0,
696                         'verb' => '',
697                         'otype' => Notification\ObjectType::ITEM,
698                         'name_cache' => 'Reply to',
699                         'msg_cache' => 'A test reply from an item',
700                 ],
701         ],
702         'profile' => [
703                 [
704                         'id' => 1,
705                         'uid' => 42,
706                 ],
707         ],
708         'group'   => [
709                 [
710                         'id'      => 1,
711                         'uid'     => 42,
712                         'visible' => 1,
713                         'name'    => 'Visible list',
714                 ],
715                 [
716                         'id'      => 2,
717                         'uid'     => 42,
718                         'visible' => 0,
719                         'name'    => 'Private list',
720                 ],
721         ],
722         'search'  => [
723                 [
724                         'id'   => 1,
725                         'term' => 'Saved search',
726                         'uid'  => 42,
727                 ],
728         ],
729 ];