Merge pull request #13942 from MrPetovan/bug/fix-api-fixture

Fix API fixture data
This commit is contained in:
Michael Vogel 2024-03-02 05:48:19 +01:00 committed by GitHub
commit 89ffe6875f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 165 additions and 170 deletions

View File

@ -24,10 +24,9 @@ namespace Friendica\Factory\Api\Twitter;
use Friendica\BaseFactory;
use Friendica\Model\APContact;
use Friendica\Model\Contact;
use Friendica\Network\HTTPException;
use Friendica\Factory\Api\Twitter\Status;
use Friendica\Model\Item;
use Friendica\Model\Post;
use Friendica\Network\HTTPException;
use Psr\Log\LoggerInterface;
class User extends BaseFactory
@ -85,9 +84,17 @@ class User extends BaseFactory
* @param bool $include_user_entities
*
* @return \Friendica\Object\Api\Twitter\User
* @throws HTTPException\InternalServerErrorException
* @throws HTTPException\NotFoundException If the $uid doesn't exist
* @throws \ImagickException
*/
public function createFromUserId(int $uid, bool $skip_status = true, bool $include_user_entities = true): \Friendica\Object\Api\Twitter\User
{
return $this->createFromContactId(Contact::getPublicIdByUserId($uid), $uid, $skip_status, $include_user_entities);
$cid = Contact::getPublicIdByUserId($uid);
if (!$cid) {
throw new HTTPException\NotFoundException();
}
return $this->createFromContactId($cid, $uid, $skip_status, $include_user_entities);
}
}

View File

@ -35,7 +35,7 @@ trait DatabaseTestTrait
// Rollbacks every DB usage (in case the test couldn't call tearDown)
StaticDatabase::statRollback();
// Rollback the first, outer transaction just 2 be sure
StaticDatabase::getGlobConnection()->rollBack();
StaticDatabase::getGlobConnection()->rollback();
// Start the first, outer transaction
StaticDatabase::getGlobConnection()->beginTransaction();
}

View File

@ -211,7 +211,7 @@ class StaticDatabase extends Database
{
if (isset(self::$staticConnection)) {
while (self::$staticConnection->getTransactionDepth() > 0) {
self::$staticConnection->rollBack();
self::$staticConnection->rollback();
}
}
}

View File

@ -25,16 +25,6 @@ use Friendica\Model\Item;
use Friendica\Model\Notification;
return [
// Empty these tables
'profile_field',
'permissionset',
'cache',
'conversation',
'pconfig',
'photo',
'workerqueue',
'mail',
'post-delivery-data',
'gserver' => [
[
'url' => 'https://friendica.local',
@ -94,22 +84,22 @@ return [
],
[
'id' => 42,
'uri' => 'http://localhost/profile/selfcontact',
'uri' => 'https://friendica.local/profile/selfcontact',
'guid' => '42',
],
[
'id' => 43,
'uri' => 'http://localhost/profile/othercontact',
'uri' => 'https://friendica.local/profile/othercontact',
'guid' => '43',
],
[
'id' => 44,
'uri' => 'http://localhost/profile/friendcontact',
'uri' => 'https://friendica.local/profile/friendcontact',
'guid' => '44',
],
[
'id' => 46,
'uri' => 'http://localhost/profile/mutualcontact',
'uri' => 'https://friendica.local/profile/mutualcontact',
'guid' => '46',
],
[
@ -126,9 +116,9 @@ return [
'name' => 'Self contact',
'nick' => 'selfcontact',
'self' => 1,
'nurl' => 'http://localhost/profile/selfcontact',
'url' => 'http://localhost/profile/selfcontact',
'notify' => 'http://localhost/friendica/inbox',
'nurl' => 'http://friendica.local/profile/selfcontact',
'url' => 'https://friendica.local/profile/selfcontact',
'notify' => 'https://friendica.local/friendica/inbox',
'about' => 'User used in tests',
'prvkey' => "-----BEGIN RSA PRIVATE KEY-----\nMIICXgIBAAKBgQDVqxF9kIgtgRL0+q+jTi578FA1r1+crEmlYc0pdxcbmmrhjuRc\nrK1gX3r0mnP25fkHzG+6CAjgbDBRFM1/RXBCyp/KHVks7eQ4yr4MxTRlsxo5qf2o\nnbyNzM7Q+LZhFhe/yIoGN/fuEjlqBE98IfPOrUjsQPX240vGNXIkfLiAWwIDAQAB\nAoGBAIwuiPIdggqAtWQ+mD8HCx5LQwSFw6/xpPu5F7ZNqL52aAsGCbL3o2QoIG4c\na1qf9Ot16BNgNBqxQF3hzRTkBMrKYlmNTUkwJXun/zjQJq2JvOlcrSuXlIucUjs4\nXekVN25aYPHrX9m2FEIUwZTb4UYXbR80KbIDI53BkQ6EwSbpAkEA7aO49CR2Hf1Y\n1d2GaUI/Z0wvbj//+t0Kg0bPt16ca8KVjEQQA5ylsDaiw510jDz9NBQxSOk6If23\nUeRixc1RDQJBAOYtN4YnPM1Zfp6IxXlqMCc+xUWRTPEPFt+WpG+v79koNamAeA6o\nZzTl92hl58IqSdbgojeE2zXWQRvlimFMLQcCQQCV6jND0byyLqFcSeQBg0l8YROK\n+dUC7W80YfeoNod3c8nkMwvnO2tLPyxvO2XLEq6prBNra7bAus5rWyj0oBIBAkEA\n1EvUMFm0TLpEfLgtWuTD8Q6GKLnxO0ztjd+FXrXpBGN/ywyArxRHzJRmctW6wmz6\nmcOqGobhIHCysKYv0bnOtQJAc2M5RwlASHH4jGJzXgt3nboyiJfufM0RV9iry3ho\nCXQRWAONKoLqnsfC6qNP8OzY8FMJcwmPWj7Q/6z6yLBFTA==\n-----END RSA PRIVATE KEY-----",
'pubkey' => "-----BEGIN PUBLIC KEY-----\nMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDVqxF9kIgtgRL0+q+jTi578FA1\nr1+crEmlYc0pdxcbmmrhjuRcrK1gX3r0mnP25fkHzG+6CAjgbDBRFM1/RXBCyp/K\nHVks7eQ4yr4MxTRlsxo5qf2onbyNzM7Q+LZhFhe/yIoGN/fuEjlqBE98IfPOrUjs\nQPX240vGNXIkfLiAWwIDAQAB\n-----END PUBLIC KEY-----",
@ -137,6 +127,7 @@ return [
'rel' => Contact::FOLLOWER,
'network' => Protocol::DFRN,
'location' => 'DFRN',
'baseurl' => 'https://friendica.local',
],
// Having the same name and nick allows us to test
// the fallback to api_get_nick() in api_get_user()
@ -147,9 +138,9 @@ return [
'name' => 'othercontact',
'nick' => 'othercontact',
'self' => 0,
'nurl' => 'http://localhost/profile/othercontact',
'url' => 'http://localhost/profile/othercontact',
'notify' => 'http://localhost/friendica/inbox',
'nurl' => 'http://friendica.local/profile/othercontact',
'url' => 'https://friendica.local/profile/othercontact',
'notify' => 'https://friendica.local/friendica/inbox',
'pending' => 0,
'blocked' => 0,
'rel' => Contact::NOTHING,
@ -163,9 +154,9 @@ return [
'name' => 'Friend contact',
'nick' => 'friendcontact',
'self' => 0,
'nurl' => 'http://localhost/profile/friendcontact',
'url' => 'http://localhost/profile/friendcontact',
'notify' => 'http://localhost/friendica/inbox',
'nurl' => 'http://friendica.local/profile/friendcontact',
'url' => 'https://friendica.local/profile/friendcontact',
'notify' => 'https://friendica.local/friendica/inbox',
'pending' => 0,
'blocked' => 0,
'rel' => Contact::SHARING,
@ -179,9 +170,9 @@ return [
'name' => 'Friend contact',
'nick' => 'friendcontact',
'self' => 0,
'nurl' => 'http://localhost/profile/friendcontact',
'url' => 'http://localhost/profile/friendcontact',
'notify' => 'http://localhost/friendica/inbox',
'nurl' => 'http://friendica.local/profile/friendcontact',
'url' => 'https://friendica.local/profile/friendcontact',
'notify' => 'https://friendica.local/friendica/inbox',
'pending' => 0,
'blocked' => 0,
'rel' => Contact::SHARING,
@ -195,9 +186,9 @@ return [
'name' => 'Mutual contact',
'nick' => 'mutualcontact',
'self' => 0,
'nurl' => 'http://localhost/profile/mutualcontact',
'url' => 'http://localhost/profile/mutualcontact',
'notify' => 'http://localhost/friendica/inbox',
'nurl' => 'http://friendica.local/profile/mutualcontact',
'url' => 'https://friendica.local/profile/mutualcontact',
'notify' => 'https://friendica.local/friendica/inbox',
'pending' => 0,
'blocked' => 0,
'rel' => Contact::FRIEND,
@ -211,9 +202,9 @@ return [
'name' => 'Mutual contact',
'nick' => 'mutualcontact',
'self' => 0,
'nurl' => 'http://localhost/profile/mutualcontact',
'url' => 'http://localhost/profile/mutualcontact',
'notify' => 'http://localhost/friendica/inbox',
'nurl' => 'http://friendica.local/profile/mutualcontact',
'url' => 'https://friendica.local/profile/mutualcontact',
'notify' => 'https://friendica.local/friendica/inbox',
'pending' => 0,
'blocked' => 0,
'rel' => Contact::SHARING,
@ -227,9 +218,9 @@ return [
'name' => 'Self contact',
'nick' => 'selfcontact',
'self' => 0,
'nurl' => 'http://localhost/profile/selfcontact',
'url' => 'http://localhost/profile/selfcontact',
'notify' => 'http://localhost/friendica/inbox',
'nurl' => 'http://friendica.local/profile/selfcontact',
'url' => 'https://friendica.local/profile/selfcontact',
'notify' => 'https://friendica.local/friendica/inbox',
'about' => 'User used in tests',
'pending' => 0,
'blocked' => 0,
@ -240,15 +231,15 @@ return [
],
'apcontact' => [
[
"url" => "http://localhost/profile/selfcontact",
"url" => "https://friendica.local/profile/selfcontact",
"uri-id" => 1,
"uuid" => "42",
"type" => "Person",
"following" => "http://localhost/following/selfcontact",
"followers" => "http://localhost/followers/selfcontact",
"inbox" => "http://localhost/inbox/selfcontact",
"outbox" => "http://localhost/outbox/selfcontact",
"sharedinbox" => "http://localhost/inbox",
"following" => "https://friendica.local/following/selfcontact",
"followers" => "https://friendica.local/followers/selfcontact",
"inbox" => "https://friendica.local/inbox/selfcontact",
"outbox" => "https://friendica.local/outbox/selfcontact",
"sharedinbox" => "https://friendica.local/inbox",
"manually-approve" => 1,
"discoverable" => 0,
"nick" => "selfcontact",
@ -256,7 +247,7 @@ return [
"about" => "User used in tests",
"xmpp" => null,
"matrix" => null,
"photo" => "http://localhost/photo/profile/admin.jpeg",
"photo" => "https://friendica.local/photo/profile/admin.jpeg",
"header" => null,
"addr" => "selfcontact@localhost",
"alias" => null,
@ -313,32 +304,32 @@ return [
[
'uri-id' => 1,
'body' => 'Parent status',
'plink' => 'http://localhost/display/1',
'plink' => 'https://friendica.local/display/1',
],
[
'uri-id' => 2,
'body' => 'Reply',
'plink' => 'http://localhost/display/2',
'plink' => 'https://friendica.local/display/2',
],
[
'uri-id' => 3,
'body' => 'Other user status',
'plink' => 'http://localhost/display/3',
'plink' => 'https://friendica.local/display/3',
],
[
'uri-id' => 4,
'body' => 'Friend user reply',
'plink' => 'http://localhost/display/4',
'plink' => 'https://friendica.local/display/4',
],
[
'uri-id' => 5,
'body' => '[share]Shared status[/share]',
'plink' => 'http://localhost/display/5',
'plink' => 'https://friendica.local/display/5',
],
[
'uri-id' => 6,
'body' => 'Friend user status',
'plink' => 'http://localhost/display/6',
'plink' => 'https://friendica.local/display/6',
],
[
'uri-id' => 7,
@ -366,7 +357,7 @@ return [
'suscipit aut facilis ut inventore omnis exercitationem quo magnam ' .
'consequatur maxime aut illum soluta quaerat natus unde aspernatur ' .
'et sed beatae nihil ullam temporibus corporis ratione blanditiis',
'plink' => 'http://localhost/display/6',
'plink' => 'https://friendica.local/display/6',
],
[
'uri-id' => 100,
@ -382,9 +373,9 @@ return [
'thr-parent-id' => 1,
'gravity' => Item::GRAVITY_PARENT,
'network' => Protocol::DFRN,
'owner-id' => 42,
'author-id' => 42,
'causer-id' => 42,
'owner-id' => 43,
'author-id' => 43,
'causer-id' => 43,
'vid' => 8,
'private' => Item::PUBLIC,
'global' => true,
@ -397,9 +388,9 @@ return [
'thr-parent-id' => 1,
'gravity' => Item::GRAVITY_COMMENT,
'network' => Protocol::DFRN,
'owner-id' => 42,
'author-id' => 42,
'causer-id' => 42,
'owner-id' => 43,
'author-id' => 43,
'causer-id' => 43,
'vid' => 8,
'private' => Item::PUBLIC,
'global' => true,
@ -412,7 +403,7 @@ return [
'thr-parent-id' => 3,
'gravity' => Item::GRAVITY_PARENT,
'network' => Protocol::DFRN,
'owner-id' => 42,
'owner-id' => 43,
'author-id' => 43,
'causer-id' => 43,
'vid' => 8,
@ -427,9 +418,9 @@ return [
'thr-parent-id' => 1,
'gravity' => Item::GRAVITY_COMMENT,
'network' => Protocol::DFRN,
'owner-id' => 42,
'author-id' => 44,
'causer-id' => 44,
'owner-id' => 43,
'author-id' => 45,
'causer-id' => 45,
'vid' => 8,
'private' => Item::PUBLIC,
'global' => true,
@ -442,9 +433,9 @@ return [
'thr-parent-id' => 1,
'gravity' => Item::GRAVITY_COMMENT,
'network' => Protocol::DFRN,
'owner-id' => 42,
'author-id' => 42,
'causer-id' => 42,
'owner-id' => 43,
'author-id' => 43,
'causer-id' => 43,
'vid' => 8,
'private' => Item::PUBLIC,
'global' => true,
@ -457,9 +448,9 @@ return [
'thr-parent-id' => 6,
'gravity' => Item::GRAVITY_PARENT,
'network' => Protocol::DFRN,
'owner-id' => 42,
'author-id' => 44,
'causer-id' => 44,
'owner-id' => 43,
'author-id' => 45,
'causer-id' => 45,
'vid' => 8,
'private' => Item::PUBLIC,
'global' => true,
@ -472,9 +463,9 @@ return [
'thr-parent-id' => 7,
'gravity' => Item::GRAVITY_PARENT,
'network' => Protocol::DFRN,
'owner-id' => 42,
'author-id' => 44,
'causer-id' => 44,
'owner-id' => 43,
'author-id' => 45,
'causer-id' => 45,
'vid' => 8,
'private' => Item::PUBLIC,
'global' => true,
@ -487,10 +478,10 @@ return [
'id' => 1,
'uri-id' => 1,
'visible' => 1,
'contact-id' => 42,
'author-id' => 42,
'owner-id' => 42,
'causer-id' => 42,
'contact-id' => 43,
'author-id' => 43,
'owner-id' => 43,
'causer-id' => 43,
'uid' => 42,
'vid' => 8,
'unseen' => 1,
@ -507,16 +498,16 @@ return [
'id' => 2,
'uri-id' => 2,
'uid' => 42,
'contact-id' => 42,
'contact-id' => 43,
'unseen' => 0,
'origin' => 1,
'parent-uri-id' => 1,
'thr-parent-id' => 1,
'gravity' => Item::GRAVITY_COMMENT,
'network' => Protocol::DFRN,
'owner-id' => 42,
'author-id' => 42,
'causer-id' => 42,
'owner-id' => 43,
'author-id' => 43,
'causer-id' => 43,
'vid' => 8,
'private' => Item::PUBLIC,
'global' => true,
@ -535,7 +526,7 @@ return [
'thr-parent-id' => 3,
'gravity' => Item::GRAVITY_PARENT,
'network' => Protocol::DFRN,
'owner-id' => 42,
'owner-id' => 43,
'author-id' => 43,
'causer-id' => 43,
'vid' => 8,
@ -549,16 +540,16 @@ return [
'id' => 4,
'uri-id' => 4,
'uid' => 42,
'contact-id' => 44,
'contact-id' => 45,
'unseen' => 0,
'origin' => 1,
'parent-uri-id' => 1,
'thr-parent-id' => 1,
'gravity' => Item::GRAVITY_COMMENT,
'network' => Protocol::DFRN,
'owner-id' => 42,
'author-id' => 44,
'causer-id' => 44,
'owner-id' => 43,
'author-id' => 45,
'causer-id' => 45,
'vid' => 8,
'private' => Item::PUBLIC,
'global' => true,
@ -570,16 +561,16 @@ return [
'id' => 5,
'uri-id' => 5,
'uid' => 42,
'contact-id' => 42,
'contact-id' => 43,
'unseen' => 0,
'origin' => 1,
'parent-uri-id' => 1,
'thr-parent-id' => 1,
'gravity' => Item::GRAVITY_COMMENT,
'network' => Protocol::DFRN,
'owner-id' => 42,
'author-id' => 42,
'causer-id' => 42,
'owner-id' => 43,
'author-id' => 43,
'causer-id' => 43,
'vid' => 8,
'private' => Item::PUBLIC,
'global' => true,
@ -591,16 +582,16 @@ return [
'id' => 6,
'uri-id' => 6,
'uid' => 42,
'contact-id' => 44,
'contact-id' => 45,
'unseen' => 0,
'origin' => 1,
'parent-uri-id' => 6,
'thr-parent-id' => 6,
'gravity' => Item::GRAVITY_PARENT,
'network' => Protocol::DFRN,
'owner-id' => 42,
'author-id' => 44,
'causer-id' => 44,
'owner-id' => 43,
'author-id' => 45,
'causer-id' => 45,
'vid' => 8,
'private' => Item::PUBLIC,
'global' => true,
@ -612,16 +603,16 @@ return [
'id' => 7,
'uri-id' => 1,
'uid' => 0,
'contact-id' => 42,
'contact-id' => 43,
'unseen' => 1,
'origin' => 0,
'parent-uri-id' => 1,
'thr-parent-id' => 1,
'gravity' => Item::GRAVITY_PARENT,
'network' => Protocol::DFRN,
'owner-id' => 42,
'author-id' => 42,
'causer-id' => 42,
'owner-id' => 43,
'author-id' => 43,
'causer-id' => 43,
'vid' => 8,
'private' => Item::PUBLIC,
'global' => true,
@ -633,16 +624,16 @@ return [
'id' => 8,
'uri-id' => 2,
'uid' => 0,
'contact-id' => 42,
'contact-id' => 43,
'unseen' => 0,
'origin' => 0,
'parent-uri-id' => 1,
'thr-parent-id' => 1,
'gravity' => Item::GRAVITY_COMMENT,
'network' => Protocol::DFRN,
'owner-id' => 42,
'author-id' => 42,
'causer-id' => 42,
'owner-id' => 43,
'author-id' => 43,
'causer-id' => 43,
'vid' => 8,
'private' => Item::PUBLIC,
'global' => true,
@ -661,7 +652,7 @@ return [
'thr-parent-id' => 3,
'gravity' => Item::GRAVITY_PARENT,
'network' => Protocol::DFRN,
'owner-id' => 42,
'owner-id' => 43,
'author-id' => 43,
'causer-id' => 43,
'vid' => 8,
@ -675,16 +666,16 @@ return [
'id' => 10,
'uri-id' => 4,
'uid' => 0,
'contact-id' => 44,
'contact-id' => 45,
'unseen' => 0,
'origin' => 0,
'parent-uri-id' => 1,
'thr-parent-id' => 1,
'gravity' => Item::GRAVITY_COMMENT,
'network' => Protocol::DFRN,
'owner-id' => 42,
'author-id' => 44,
'causer-id' => 44,
'owner-id' => 43,
'author-id' => 45,
'causer-id' => 45,
'vid' => 8,
'private' => Item::PUBLIC,
'global' => true,
@ -696,16 +687,16 @@ return [
'id' => 11,
'uri-id' => 5,
'uid' => 0,
'contact-id' => 42,
'contact-id' => 43,
'unseen' => 0,
'origin' => 0,
'parent-uri-id' => 1,
'thr-parent-id' => 1,
'gravity' => Item::GRAVITY_COMMENT,
'network' => Protocol::DFRN,
'owner-id' => 42,
'author-id' => 42,
'causer-id' => 42,
'owner-id' => 43,
'author-id' => 43,
'causer-id' => 43,
'vid' => 8,
'private' => Item::PUBLIC,
'global' => true,
@ -717,10 +708,10 @@ return [
'id' => 12,
'uri-id' => 6,
'visible' => 1,
'contact-id' => 44,
'author-id' => 44,
'owner-id' => 42,
'causer-id' => 44,
'contact-id' => 45,
'author-id' => 45,
'owner-id' => 43,
'causer-id' => 45,
'uid' => 0,
'vid' => 8,
'unseen' => 0,
@ -738,10 +729,10 @@ return [
'id' => 13,
'uri-id' => 7,
'visible' => 1,
'contact-id' => 44,
'author-id' => 44,
'owner-id' => 42,
'causer-id' => 44,
'contact-id' => 45,
'author-id' => 45,
'owner-id' => 43,
'causer-id' => 45,
'uid' => 0,
'vid' => 8,
'unseen' => 0,
@ -760,10 +751,10 @@ return [
'id' => 14,
'uri-id' => 100,
'visible' => 1,
'contact-id' => 44,
'author-id' => 44,
'owner-id' => 42,
'causer-id' => 44,
'contact-id' => 45,
'author-id' => 45,
'owner-id' => 43,
'causer-id' => 45,
'uid' => 0,
'vid' => 8,
'unseen' => 0,
@ -781,9 +772,9 @@ return [
'post-thread' => [
[
'uri-id' => 1,
'author-id' => 42,
'owner-id' => 42,
'causer-id' => 42,
'author-id' => 43,
'owner-id' => 43,
'causer-id' => 43,
'network' => Protocol::DFRN,
],
[
@ -795,16 +786,16 @@ return [
],
[
'uri-id' => 6,
'author-id' => 44,
'owner-id' => 44,
'causer-id' => 44,
'author-id' => 45,
'owner-id' => 45,
'causer-id' => 45,
'network' => Protocol::DFRN,
],
[
'uri-id' => 7,
'author-id' => 44,
'owner-id' => 44,
'causer-id' => 44,
'author-id' => 45,
'owner-id' => 45,
'causer-id' => 45,
'network' => Protocol::DFRN,
],
],
@ -814,10 +805,10 @@ return [
'uid' => 42,
'wall' => 1,
'post-user-id' => 1,
'author-id' => 42,
'owner-id' => 42,
'causer-id' => 42,
'contact-id' => 42,
'author-id' => 43,
'owner-id' => 43,
'causer-id' => 43,
'contact-id' => 43,
'network' => Protocol::DFRN,
'starred' => 1,
'origin' => 1,
@ -840,10 +831,10 @@ return [
'uid' => 42,
'wall' => 1,
'post-user-id' => 6,
'author-id' => 44,
'owner-id' => 44,
'causer-id' => 44,
'contact-id' => 44,
'author-id' => 45,
'owner-id' => 45,
'causer-id' => 45,
'contact-id' => 45,
'network' => Protocol::DFRN,
'starred' => 0,
'origin' => 1,
@ -853,10 +844,10 @@ return [
'uid' => 0,
'wall' => 0,
'post-user-id' => 7,
'author-id' => 42,
'owner-id' => 42,
'causer-id' => 42,
'contact-id' => 42,
'author-id' => 43,
'owner-id' => 43,
'causer-id' => 43,
'contact-id' => 43,
'network' => Protocol::DFRN,
'starred' => 0,
'origin' => 0,
@ -879,10 +870,10 @@ return [
'uid' => 0,
'wall' => 0,
'post-user-id' => 12,
'author-id' => 44,
'owner-id' => 44,
'causer-id' => 44,
'contact-id' => 44,
'author-id' => 45,
'owner-id' => 45,
'causer-id' => 45,
'contact-id' => 45,
'network' => Protocol::DFRN,
'starred' => 0,
'origin' => 0,
@ -892,10 +883,10 @@ return [
'uid' => 42,
'wall' => 1,
'post-user-id' => 7,
'author-id' => 44,
'owner-id' => 44,
'causer-id' => 44,
'contact-id' => 44,
'author-id' => 45,
'owner-id' => 45,
'causer-id' => 45,
'contact-id' => 45,
'network' => Protocol::DFRN,
'starred' => 0,
'origin' => 1,
@ -905,10 +896,10 @@ return [
'uid' => 0,
'wall' => 0,
'post-user-id' => 12,
'author-id' => 44,
'owner-id' => 44,
'causer-id' => 44,
'contact-id' => 44,
'author-id' => 45,
'owner-id' => 45,
'causer-id' => 45,
'contact-id' => 45,
'network' => Protocol::DFRN,
'starred' => 0,
'origin' => 0,
@ -919,12 +910,12 @@ return [
'id' => 1,
'type' => 8,
'name' => 'Friend contact',
'url' => 'http://localhost/profile/friendcontact',
'photo' => 'http://localhost/',
'url' => 'https://friendica.local/profile/friendcontact',
'photo' => 'https://friendica.local/',
'date' => '2020-01-01 12:12:02',
'msg' => 'A test reply from an item',
'uid' => 42,
'link' => 'http://localhost/display/1',
'link' => 'https://friendica.local/display/1',
'iid' => 4,
'seen' => 0,
'verb' => \Friendica\Protocol\Activity::POST,
@ -957,12 +948,12 @@ return [
[
'id' => 1,
'gid' => 1,
'contact-id' => 42,
'contact-id' => 43,
],
[
'id' => 2,
'gid' => 1,
'contact-id' => 42,
'contact-id' => 43,
],
[
'id' => 3,

View File

@ -23,6 +23,7 @@ namespace Friendica\Test\src\Factory\Api\Twitter;
use Friendica\DI;
use Friendica\Factory\Api\Twitter\User;
use Friendica\Network\HTTPException\NotFoundException;
use Friendica\Test\FixtureTest;
use Friendica\Test\src\Module\Api\ApiTest;
@ -133,15 +134,11 @@ class UserTest extends FixtureTest
*/
public function testApiGetUserWithWrongGetId()
{
$this->expectException(NotFoundException::class);
$user = (new User(DI::logger(), DI::twitterStatus()))
->createFromUserId(-1)
->toArray();
self::assertEquals(0, $user['id']);
self::assertEquals(0, $user['uid']);
self::assertEquals(0, $user['cid']);
self::assertEquals(0, $user['pid']);
self::assertEmpty($user['name']);
}
/**

View File

@ -62,7 +62,7 @@ class NotificationTest extends ApiTest
$assertXml = <<<XML
<?xml version="1.0"?>
<notes>
<note date="$date" date_rel="$dateRel" id="1" iid="4" link="http://localhost/display/1" msg="A test reply from an item" msg_cache="A test reply from an item" msg_html="A test reply from an item" msg_plain="A test reply from an item" name="Friend contact" name_cache="Friend contact" otype="item" parent="" photo="http://localhost/" seen="false" timestamp="1577880722" type="8" uid="42" url="http://localhost/profile/friendcontact" verb="http://activitystrea.ms/schema/1.0/post"/>
<note date="$date" date_rel="$dateRel" id="1" iid="4" link="https://friendica.local/display/1" msg="A test reply from an item" msg_cache="A test reply from an item" msg_html="A test reply from an item" msg_plain="A test reply from an item" name="Friend contact" name_cache="Friend contact" otype="item" parent="" photo="https://friendica.local/" seen="false" timestamp="1577880722" type="8" uid="42" url="https://friendica.local/profile/friendcontact" verb="http://activitystrea.ms/schema/1.0/post"/>
</notes>
XML;

View File

@ -38,7 +38,7 @@ class UserTimelineTest extends ApiTest
{
$response = (new UserTimeline(DI::mstdnError(), DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), []))
->run($this->httpExceptionMock, [
'user_id' => 42,
'user_id' => 43, // Public contact id
'max_id' => 10,
'exclude_replies' => true,
'conversation_id' => 1,
@ -63,7 +63,7 @@ class UserTimelineTest extends ApiTest
{
$response = (new UserTimeline(DI::mstdnError(), DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), []))
->run($this->httpExceptionMock, [
'user_id' => 42,
'user_id' => 43, // Public contact id
'page' => -2,
]);