|
|
|
|
@ -786,20 +786,41 @@ class AccountManagerTest extends TestCase {
|
|
|
|
|
'@foo@example.com',
|
|
|
|
|
'foo@example.com',
|
|
|
|
|
true,
|
|
|
|
|
json_encode(['username' => 'foo']),
|
|
|
|
|
json_encode([
|
|
|
|
|
'subject' => 'acct:foo@example.com',
|
|
|
|
|
'links' => [
|
|
|
|
|
[
|
|
|
|
|
'rel' => 'self',
|
|
|
|
|
'type' => 'application/activity+json',
|
|
|
|
|
'href' => 'https://example.com/users/foo',
|
|
|
|
|
],
|
|
|
|
|
],
|
|
|
|
|
]),
|
|
|
|
|
],
|
|
|
|
|
'valid response - no at' => [
|
|
|
|
|
'foo@example.com',
|
|
|
|
|
'foo@example.com',
|
|
|
|
|
true,
|
|
|
|
|
json_encode(['username' => 'foo']),
|
|
|
|
|
json_encode([
|
|
|
|
|
'subject' => 'acct:foo@example.com',
|
|
|
|
|
'links' => [
|
|
|
|
|
[
|
|
|
|
|
'rel' => 'self',
|
|
|
|
|
'type' => 'application/activity+json',
|
|
|
|
|
'href' => 'https://example.com/users/foo',
|
|
|
|
|
],
|
|
|
|
|
],
|
|
|
|
|
]),
|
|
|
|
|
],
|
|
|
|
|
// failures
|
|
|
|
|
'invalid response' => [
|
|
|
|
|
'@foo@example.com',
|
|
|
|
|
null,
|
|
|
|
|
true,
|
|
|
|
|
json_encode(['not found']),
|
|
|
|
|
json_encode([
|
|
|
|
|
'subject' => 'acct:foo@example.com',
|
|
|
|
|
'links' => [],
|
|
|
|
|
]),
|
|
|
|
|
],
|
|
|
|
|
'no response' => [
|
|
|
|
|
'@foo@example.com',
|
|
|
|
|
@ -811,7 +832,9 @@ class AccountManagerTest extends TestCase {
|
|
|
|
|
'@foo@example.com',
|
|
|
|
|
null,
|
|
|
|
|
true,
|
|
|
|
|
json_encode(['username' => 'foo@other.example.com']),
|
|
|
|
|
json_encode([
|
|
|
|
|
'links' => [],
|
|
|
|
|
]),
|
|
|
|
|
],
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
@ -831,12 +854,12 @@ class AccountManagerTest extends TestCase {
|
|
|
|
|
->willReturn($serverResponse);
|
|
|
|
|
$client->expects(self::once())
|
|
|
|
|
->method('get')
|
|
|
|
|
->with('https://example.com/api/v1/accounts/lookup?acct=foo@example.com')
|
|
|
|
|
->with('https://example.com/.well-known/webfinger?resource=acct:foo@example.com')
|
|
|
|
|
->willReturn($response);
|
|
|
|
|
} else {
|
|
|
|
|
$client->expects(self::once())
|
|
|
|
|
->method('get')
|
|
|
|
|
->with('https://example.com/api/v1/accounts/lookup?acct=foo@example.com')
|
|
|
|
|
->with('https://example.com/.well-known/webfinger?resource=acct:foo@example.com')
|
|
|
|
|
->willThrowException(new \Exception('404'));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|