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