]> git.mxchange.org Git - friendica.git/blob - tests/datasets/api.fixture.php
Reduce the usage of the "proxifyUrl" function
[friendica.git] / tests / datasets / api.fixture.php
1 <?php
2 /**
3  * @copyright Copyright (C) 2010-2021, the Friendica project
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                         'wall'          => 1,
369                         'origin'        => 1,
370                 ],
371                 [
372                         'id'            => 2,
373                         'uri-id'        => 2,
374                         'uid'           => 42,
375                         'contact-id'    => 42,
376                         'unseen'        => 0,
377                         'origin'        => 1,
378                         'parent-uri-id' => 1,
379                         'thr-parent-id' => 1,
380                         'gravity'       => GRAVITY_COMMENT,
381                         'network'       => Protocol::DFRN,
382                         'owner-id'      => 42,
383                         'author-id'     => 42,
384                         'causer-id'     => 42,
385                         'vid'           => 8,
386                         'private'       => Item::PUBLIC,
387                         'visible'       => 1,
388                         'deleted'       => 0,
389                         'wall'          => 1,
390                 ],
391                 [
392                         'id'            => 3,
393                         'uri-id'        => 3,
394                         'uid'           => 42,
395                         'contact-id'    => 43,
396                         'unseen'        => 0,
397                         'origin'        => 1,
398                         'parent-uri-id' => 3,
399                         'thr-parent-id' => 3,
400                         'gravity'       => GRAVITY_PARENT,
401                         'network'       => Protocol::DFRN,
402                         'owner-id'      => 42,
403                         'author-id'     => 43,
404                         'causer-id'     => 43,
405                         'vid'           => 8,
406                         'private'       => Item::PUBLIC,
407                         'visible'       => 1,
408                         'deleted'       => 0,
409                         'wall'          => 1,
410                 ],
411                 [
412                         'id'            => 4,
413                         'uri-id'        => 4,
414                         'uid'           => 42,
415                         'contact-id'    => 44,
416                         'unseen'        => 0,
417                         'origin'        => 1,
418                         'parent-uri-id' => 1,
419                         'thr-parent-id' => 1,
420                         'gravity'       => GRAVITY_COMMENT,
421                         'network'       => Protocol::DFRN,
422                         'owner-id'      => 42,
423                         'author-id'     => 44,
424                         'causer-id'     => 44,
425                         'vid'           => 8,
426                         'private'       => Item::PUBLIC,
427                         'visible'       => 1,
428                         'deleted'       => 0,
429                         'wall'          => 1,
430                 ],
431                 [
432                         'id'            => 5,
433                         'uri-id'        => 5,
434                         'uid'           => 42,
435                         'contact-id'    => 42,
436                         'unseen'        => 0,
437                         'origin'        => 1,
438                         'parent-uri-id' => 1,
439                         'thr-parent-id' => 1,
440                         'gravity'       => GRAVITY_COMMENT,
441                         'network'       => Protocol::DFRN,
442                         'owner-id'      => 42,
443                         'author-id'     => 42,
444                         'causer-id'     => 42,
445                         'vid'           => 8,
446                         'private'       => Item::PUBLIC,
447                         'visible'       => 1,
448                         'deleted'       => 0,
449                         'wall'          => 1,
450                 ],
451                 [
452                         'id'            => 6,
453                         'uri-id'        => 6,
454                         'uid'           => 42,
455                         'contact-id'    => 44,
456                         'unseen'        => 0,
457                         'origin'        => 1,
458                         'parent-uri-id' => 6,
459                         'thr-parent-id' => 6,
460                         'gravity'       => GRAVITY_PARENT,
461                         'network'       => Protocol::DFRN,
462                         'owner-id'      => 42,
463                         'author-id'     => 44,
464                         'causer-id'     => 44,
465                         'vid'           => 8,
466                         'private'       => Item::PUBLIC,
467                         'visible'       => 1,
468                         'deleted'       => 0,
469                         'wall'          => 1,
470                 ],
471                 [
472                         'id'            => 7,
473                         'uri-id'        => 1,
474                         'uid'           => 0,
475                         'contact-id'    => 42,
476                         'unseen'        => 1,
477                         'origin'        => 0,
478                         'parent-uri-id' => 1,
479                         'thr-parent-id' => 1,
480                         'gravity'       => GRAVITY_PARENT,
481                         'network'       => Protocol::DFRN,
482                         'owner-id'      => 42,
483                         'author-id'     => 42,
484                         'causer-id'     => 42,
485                         'vid'           => 8,
486                         'private'       => Item::PUBLIC,
487                         'visible'       => 1,
488                         'deleted'       => 0,
489                         'wall'          => 0,
490                 ],
491                 [
492                         'id'            => 8,
493                         'uri-id'        => 2,
494                         'uid'           => 0,
495                         'contact-id'    => 42,
496                         'unseen'        => 0,
497                         'origin'        => 0,
498                         'parent-uri-id' => 1,
499                         'thr-parent-id' => 1,
500                         'gravity'       => GRAVITY_COMMENT,
501                         'network'       => Protocol::DFRN,
502                         'owner-id'      => 42,
503                         'author-id'     => 42,
504                         'causer-id'     => 42,
505                         'vid'           => 8,
506                         'private'       => Item::PUBLIC,
507                         'visible'       => 1,
508                         'deleted'       => 0,
509                         'wall'          => 0,
510                 ],
511                 [
512                         'id'            => 9,
513                         'uri-id'        => 3,
514                         'uid'           => 0,
515                         'contact-id'    => 43,
516                         'unseen'        => 0,
517                         'origin'        => 0,
518                         'parent-uri-id' => 3,
519                         'thr-parent-id' => 3,
520                         'gravity'       => GRAVITY_PARENT,
521                         'network'       => Protocol::DFRN,
522                         'owner-id'      => 42,
523                         'author-id'     => 43,
524                         'causer-id'     => 43,
525                         'vid'           => 8,
526                         'private'       => Item::PUBLIC,
527                         'visible'       => 1,
528                         'deleted'       => 0,
529                         'wall'          => 0,
530                 ],
531                 [
532                         'id'            => 10,
533                         'uri-id'        => 4,
534                         'uid'           => 0,
535                         'contact-id'    => 44,
536                         'unseen'        => 0,
537                         'origin'        => 0,
538                         'parent-uri-id' => 1,
539                         'thr-parent-id' => 1,
540                         'gravity'       => GRAVITY_COMMENT,
541                         'network'       => Protocol::DFRN,
542                         'owner-id'      => 42,
543                         'author-id'     => 44,
544                         'causer-id'     => 44,
545                         'vid'           => 8,
546                         'private'       => Item::PUBLIC,
547                         'visible'       => 1,
548                         'deleted'       => 0,
549                         'wall'          => 0,
550                 ],
551                 [
552                         'id'            => 11,
553                         'uri-id'        => 5,
554                         'uid'           => 0,
555                         'contact-id'    => 42,
556                         'unseen'        => 0,
557                         'origin'        => 0,
558                         'parent-uri-id' => 1,
559                         'thr-parent-id' => 1,
560                         'gravity'       => GRAVITY_COMMENT,
561                         'network'       => Protocol::DFRN,
562                         'owner-id'      => 42,
563                         'author-id'     => 42,
564                         'causer-id'     => 42,
565                         'vid'           => 8,
566                         'private'       => Item::PUBLIC,
567                         'visible'       => 1,
568                         'deleted'       => 0,
569                         'wall'          => 0,
570                 ],
571                 [
572                         'id'            => 12,
573                         'uri-id'        => 6,
574                         'visible'       => 1,
575                         'contact-id'    => 44,
576                         'author-id'     => 44,
577                         'owner-id'      => 42,
578                         'causer-id'     => 44,
579                         'uid'           => 0,
580                         'vid'           => 8,
581                         'unseen'        => 0,
582                         'parent-uri-id' => 6,
583                         'thr-parent-id' => 6,
584                         'private'       => Item::PUBLIC,
585                         'gravity'       => GRAVITY_PARENT,
586                         'network'       => Protocol::DFRN,
587                         'origin'        => 0,
588                         'deleted'       => 0,
589                         'wall'          => 0,
590                 ],
591         ],
592         'post-thread'  => [
593                 [
594                         'uri-id'     => 1,
595                         'author-id'  => 42,
596                         'owner-id'   => 42,
597                         'causer-id'  => 42,
598                         'network'    => Protocol::DFRN,
599                 ],
600                 [
601                         'uri-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                         'author-id'  => 44,
610                         'owner-id'   => 44,
611                         'causer-id'  => 44,
612                         'network'    => Protocol::DFRN,
613                 ],
614         ],
615         'post-thread-user'  => [
616                 [
617                         'uri-id'     => 1,
618                         'uid'        => 42,
619                         'wall'       => 1,
620                         'post-user-id' => 1,
621                         'author-id'  => 42,
622                         'owner-id'   => 42,
623                         'causer-id'  => 42,
624                         'contact-id' => 42,
625                         'network'    => Protocol::DFRN,
626                         'starred'    => 1,
627                         'origin'     => 1,
628                 ],
629                 [
630                         'uri-id'     => 3,
631                         'uid'        => 42,
632                         'wall'       => 1,
633                         'post-user-id' => 3,
634                         'author-id'  => 43,
635                         'owner-id'   => 43,
636                         'causer-id'  => 43,
637                         'contact-id' => 43,
638                         'network'    => Protocol::DFRN,
639                         'starred'    => 0,
640                         'origin'     => 1,
641                 ],
642                 [
643                         'uri-id'     => 6,
644                         'uid'        => 42,
645                         'wall'       => 1,
646                         'post-user-id' => 6,
647                         'author-id'  => 44,
648                         'owner-id'   => 44,
649                         'causer-id'  => 44,
650                         'contact-id' => 44,
651                         'network'    => Protocol::DFRN,
652                         'starred'    => 0,
653                         'origin'     => 1,
654                 ],
655                 [
656                         'uri-id'     => 1,
657                         'uid'        => 0,
658                         'wall'       => 0,
659                         'post-user-id' => 7,
660                         'author-id'  => 42,
661                         'owner-id'   => 42,
662                         'causer-id'  => 42,
663                         'contact-id' => 42,
664                         'network'    => Protocol::DFRN,
665                         'starred'    => 0,
666                         'origin'     => 0,
667                 ],
668                 [
669                         'uri-id'     => 3,
670                         'uid'        => 0,
671                         'wall'       => 0,
672                         'post-user-id' => 9,
673                         'author-id'  => 43,
674                         'owner-id'   => 43,
675                         'causer-id'  => 43,
676                         'contact-id' => 43,
677                         'network'    => Protocol::DFRN,
678                         'starred'    => 0,
679                         'origin'     => 0,
680                 ],
681                 [
682                         'uri-id'     => 6,
683                         'uid'        => 0,
684                         'wall'       => 0,
685                         'post-user-id' => 12,
686                         'author-id'  => 44,
687                         'owner-id'   => 44,
688                         'causer-id'  => 44,
689                         'contact-id' => 44,
690                         'network'    => Protocol::DFRN,
691                         'starred'    => 0,
692                         'origin'     => 0,
693                 ],
694         ],
695         'notify' => [
696                 [
697                         'id' => 1,
698                         'type' => 8,
699                         'name' => 'Reply to',
700                         'url' => 'http://localhost/display/1',
701                         'photo' => 'http://localhost/',
702                         'date' => '2020-01-01 12:12:02',
703                         'msg' => 'A test reply from an item',
704                         'uid' => 42,
705                         'link' => 'http://localhost/notification/1',
706                         'iid' => 4,
707                         'seen' => 0,
708                         'verb' => '',
709                         'otype' => Notification\ObjectType::ITEM,
710                         'name_cache' => 'Reply to',
711                         'msg_cache' => 'A test reply from an item',
712                 ],
713         ],
714         'profile' => [
715                 [
716                         'id' => 1,
717                         'uid' => 42,
718                 ],
719         ],
720         'group'   => [
721                 [
722                         'id'      => 1,
723                         'uid'     => 42,
724                         'visible' => 1,
725                         'name'    => 'Visible list',
726                 ],
727                 [
728                         'id'      => 2,
729                         'uid'     => 42,
730                         'visible' => 0,
731                         'name'    => 'Private list',
732                 ],
733         ],
734         'search'  => [
735                 [
736                         'id'   => 1,
737                         'term' => 'Saved search',
738                         'uid'  => 42,
739                 ],
740         ],
741 ];