Browse Source

Fix the tests, hopefully

pull/10478/head
Michael 3 months ago
parent
commit
e0fdde3287
  1. 2
      src/Model/Contact.php
  2. 91
      tests/datasets/api.fixture.php
  3. 8
      tests/datasets/storage/database.fixture.php

2
src/Model/Contact.php

@ -1077,7 +1077,7 @@ class Contact
if (!empty($contact)) {
$contact_id = $contact["id"];
if (empty($update)) {
if (empty($update) && (!empty($contact['uri-id']) || is_bool($update))) {
Logger::debug('Contact found', ['url' => $url, 'uid' => $uid, 'update' => $update, 'cid' => $contact_id]);
return $contact_id;
}

91
tests/datasets/api.fixture.php

@ -71,10 +71,64 @@ return [
'theme' => 'frio',
],
],
'item-uri' => [
[
'id' => 1,
'uri' => '1',
'guid' => '1',
],
[
'id' => 2,
'uri' => '2',
'guid' => '2',
],
[
'id' => 3,
'uri' => '3',
'guid' => '3',
],
[
'id' => 4,
'uri' => '4',
'guid' => '4',
],
[
'id' => 5,
'uri' => '5',
'guid' => '5',
],
[
'id' => 6,
'uri' => '6',
'guid' => '6',
],
[
'id' => 42,
'uri' => 'http://localhost/profile/selfcontact',
'guid' => '42',
],
[
'id' => 43,
'uri' => 'http://localhost/profile/othercontact',
'guid' => '43',
],
[
'id' => 44,
'uri' => 'http://localhost/profile/friendcontact',
'guid' => '44',
],
[
'id' => 46,
'uri' => 'http://localhost/profile/mutualcontact',
'guid' => '46',
],
],
'contact' => [
[
'id' => 42,
'uid' => 42,
'uri-id' => 42,
'name' => 'Self contact',
'nick' => 'selfcontact',
'self' => 1,
@ -92,6 +146,7 @@ return [
[
'id' => 43,
'uid' => 0,
'uri-id' => 43,
'name' => 'othercontact',
'nick' => 'othercontact',
'self' => 0,
@ -106,6 +161,7 @@ return [
[
'id' => 44,
'uid' => 42,
'uri-id' => 44,
'name' => 'Friend contact',
'nick' => 'friendcontact',
'self' => 0,
@ -120,6 +176,7 @@ return [
[
'id' => 45,
'uid' => 0,
'uri-id' => 44,
'name' => 'Friend contact',
'nick' => 'friendcontact',
'self' => 0,
@ -134,6 +191,7 @@ return [
[
'id' => 46,
'uid' => 42,
'uri-id' => 46,
'name' => 'Mutual contact',
'nick' => 'mutualcontact',
'self' => 0,
@ -148,6 +206,7 @@ return [
[
'id' => 47,
'uid' => 0,
'uri-id' => 46,
'name' => 'Mutual contact',
'nick' => 'mutualcontact',
'self' => 0,
@ -160,38 +219,6 @@ return [
'location' => 'DFRN',
],
],
'item-uri' => [
[
'id' => 1,
'uri' => '1',
'guid' => '1',
],
[
'id' => 2,
'uri' => '2',
'guid' => '2',
],
[
'id' => 3,
'uri' => '3',
'guid' => '3',
],
[
'id' => 4,
'uri' => '4',
'guid' => '4',
],
[
'id' => 5,
'uri' => '5',
'guid' => '5',
],
[
'id' => 6,
'uri' => '6',
'guid' => '6',
],
],
'verb' => [
[
'id' => 0,

8
tests/datasets/storage/database.fixture.php

@ -33,10 +33,18 @@ return [
'theme' => 'frio',
],
],
'item-uri' => [
[
'id' => 42,
'uri' => 'http://localhost/profile/selfcontact',
'guid' => '42',
],
],
'contact' => [
[
'id' => 42,
'uid' => 42,
'uri-id' => 42,
'name' => 'Self contact',
'nick' => 'selfcontact',
'self' => 1,

Loading…
Cancel
Save