mirror of
https://git.friendi.ca/friendica/friendica.git
synced 2025-06-17 03:25:15 +02:00
Merge remote-tracking branch 'friendica/stable' into develop
# Conflicts: # composer.lock
This commit is contained in:
commit
a852455d0e
154 changed files with 26577 additions and 25630 deletions
|
@ -3,7 +3,7 @@
|
|||
* ApiTest class.
|
||||
*/
|
||||
|
||||
namespace Friendica\Test;
|
||||
namespace Friendica\Test\legacy;
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Config\IConfig;
|
||||
|
@ -11,6 +11,7 @@ use Friendica\Core\PConfig\IPConfig;
|
|||
use Friendica\Core\Protocol;
|
||||
use Friendica\DI;
|
||||
use Friendica\Network\HTTPException;
|
||||
use Friendica\Test\FixtureTest;
|
||||
use Friendica\Util\Temporal;
|
||||
use Monolog\Handler\TestHandler;
|
||||
|
||||
|
@ -49,6 +50,10 @@ class ApiTest extends FixtureTest
|
|||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
global $API, $called_api;
|
||||
$API = [];
|
||||
$called_api = [];
|
||||
|
||||
parent::setUp();
|
||||
|
||||
/** @var IConfig $config */
|
||||
|
@ -70,7 +75,7 @@ class ApiTest extends FixtureTest
|
|||
$this->app = DI::app();
|
||||
|
||||
$this->app->argc = 1;
|
||||
$this->app->argv = ['home'];
|
||||
$this->app->argv = [''];
|
||||
|
||||
// User data that the test database is populated with
|
||||
$this->selfUser = [
|
||||
|
@ -412,7 +417,7 @@ class ApiTest extends FixtureTest
|
|||
}
|
||||
];
|
||||
$_SERVER['REQUEST_METHOD'] = 'method';
|
||||
$_SERVER['QUERY_STRING'] = 'q=api_path';
|
||||
$_SERVER['QUERY_STRING'] = 'pagename=api_path';
|
||||
$_GET['callback'] = 'callback_name';
|
||||
|
||||
$args = DI::args()->determine($_SERVER, $_GET);
|
||||
|
@ -440,7 +445,7 @@ class ApiTest extends FixtureTest
|
|||
];
|
||||
|
||||
$_SERVER['REQUEST_METHOD'] = 'method';
|
||||
$_SERVER['QUERY_STRING'] = 'q=api_path';
|
||||
$_SERVER['QUERY_STRING'] = 'pagename=api_path';
|
||||
|
||||
$args = DI::args()->determine($_SERVER, $_GET);
|
||||
|
||||
|
@ -476,7 +481,7 @@ class ApiTest extends FixtureTest
|
|||
}
|
||||
];
|
||||
$_SERVER['REQUEST_METHOD'] = 'method';
|
||||
$_SERVER['QUERY_STRING'] = 'q=api_path';
|
||||
$_SERVER['QUERY_STRING'] = 'pagename=api_path';
|
||||
|
||||
$args = DI::args()->determine($_SERVER, $_GET);
|
||||
|
||||
|
@ -516,7 +521,7 @@ class ApiTest extends FixtureTest
|
|||
}
|
||||
];
|
||||
$_SERVER['REQUEST_METHOD'] = 'method';
|
||||
$_SERVER['QUERY_STRING'] = 'q=api_path.json';
|
||||
$_SERVER['QUERY_STRING'] = 'pagename=api_path.json';
|
||||
|
||||
$args = DI::args()->determine($_SERVER, $_GET);
|
||||
|
||||
|
@ -542,7 +547,7 @@ class ApiTest extends FixtureTest
|
|||
}
|
||||
];
|
||||
$_SERVER['REQUEST_METHOD'] = 'method';
|
||||
$_SERVER['QUERY_STRING'] = 'q=api_path.xml';
|
||||
$_SERVER['QUERY_STRING'] = 'pagename=api_path.xml';
|
||||
|
||||
$args = DI::args()->determine($_SERVER, $_GET);
|
||||
|
||||
|
@ -568,7 +573,7 @@ class ApiTest extends FixtureTest
|
|||
}
|
||||
];
|
||||
$_SERVER['REQUEST_METHOD'] = 'method';
|
||||
$_SERVER['QUERY_STRING'] = 'q=api_path.rss';
|
||||
$_SERVER['QUERY_STRING'] = 'pagename=api_path.rss';
|
||||
|
||||
$args = DI::args()->determine($_SERVER, $_GET);
|
||||
|
||||
|
@ -595,7 +600,7 @@ class ApiTest extends FixtureTest
|
|||
}
|
||||
];
|
||||
$_SERVER['REQUEST_METHOD'] = 'method';
|
||||
$_SERVER['QUERY_STRING'] = 'q=api_path.atom';
|
||||
$_SERVER['QUERY_STRING'] = 'pagename=api_path.atom';
|
||||
|
||||
$args = DI::args()->determine($_SERVER, $_GET);
|
||||
|
||||
|
@ -617,7 +622,7 @@ class ApiTest extends FixtureTest
|
|||
global $API;
|
||||
$API['api_path'] = ['method' => 'method'];
|
||||
|
||||
$_SERVER['QUERY_STRING'] = 'q=api_path';
|
||||
$_SERVER['QUERY_STRING'] = 'pagename=api_path';
|
||||
|
||||
$args = DI::args()->determine($_SERVER, $_GET);
|
||||
|
||||
|
@ -642,7 +647,7 @@ class ApiTest extends FixtureTest
|
|||
];
|
||||
$_SESSION['authenticated'] = false;
|
||||
$_SERVER['REQUEST_METHOD'] = 'method';
|
||||
$_SERVER['QUERY_STRING'] = 'q=api_path';
|
||||
$_SERVER['QUERY_STRING'] = 'pagename=api_path';
|
||||
|
||||
$args = DI::args()->determine($_SERVER, $_GET);
|
||||
|
|
@ -45,8 +45,8 @@ class ArgumentsTest extends TestCase
|
|||
$this->assertArguments([
|
||||
'queryString' => '',
|
||||
'command' => '',
|
||||
'argv' => ['home'],
|
||||
'argc' => 1,
|
||||
'argv' => [],
|
||||
'argc' => 0,
|
||||
],
|
||||
$arguments);
|
||||
}
|
||||
|
@ -55,34 +55,6 @@ class ArgumentsTest extends TestCase
|
|||
{
|
||||
return [
|
||||
'withPagename' => [
|
||||
'assert' => [
|
||||
'queryString' => 'profile/test/it?arg1=value1&arg2=value2',
|
||||
'command' => 'profile/test/it',
|
||||
'argv' => ['profile', 'test', 'it'],
|
||||
'argc' => 3,
|
||||
],
|
||||
'server' => [
|
||||
'QUERY_STRING' => 'pagename=profile/test/it?arg1=value1&arg2=value2',
|
||||
],
|
||||
'get' => [
|
||||
'pagename' => 'profile/test/it',
|
||||
],
|
||||
],
|
||||
'withQ' => [
|
||||
'assert' => [
|
||||
'queryString' => 'profile/test/it?arg1=value1&arg2=value2',
|
||||
'command' => 'profile/test/it',
|
||||
'argv' => ['profile', 'test', 'it'],
|
||||
'argc' => 3,
|
||||
],
|
||||
'server' => [
|
||||
'QUERY_STRING' => 'q=profile/test/it?arg1=value1&arg2=value2',
|
||||
],
|
||||
'get' => [
|
||||
'q' => 'profile/test/it',
|
||||
],
|
||||
],
|
||||
'withWrongDelimiter' => [
|
||||
'assert' => [
|
||||
'queryString' => 'profile/test/it?arg1=value1&arg2=value2',
|
||||
'command' => 'profile/test/it',
|
||||
|
@ -99,12 +71,12 @@ class ArgumentsTest extends TestCase
|
|||
'withUnixHomeDir' => [
|
||||
'assert' => [
|
||||
'queryString' => '~test/it?arg1=value1&arg2=value2',
|
||||
'command' => 'profile/test/it',
|
||||
'argv' => ['profile', 'test', 'it'],
|
||||
'argc' => 3,
|
||||
'command' => '~test/it',
|
||||
'argv' => ['~test', 'it'],
|
||||
'argc' => 2,
|
||||
],
|
||||
'server' => [
|
||||
'QUERY_STRING' => 'pagename=~test/it?arg1=value1&arg2=value2',
|
||||
'QUERY_STRING' => 'pagename=~test/it&arg1=value1&arg2=value2',
|
||||
],
|
||||
'get' => [
|
||||
'pagename' => '~test/it',
|
||||
|
@ -113,12 +85,12 @@ class ArgumentsTest extends TestCase
|
|||
'withDiasporaHomeDir' => [
|
||||
'assert' => [
|
||||
'queryString' => 'u/test/it?arg1=value1&arg2=value2',
|
||||
'command' => 'profile/test/it',
|
||||
'argv' => ['profile', 'test', 'it'],
|
||||
'command' => 'u/test/it',
|
||||
'argv' => ['u', 'test', 'it'],
|
||||
'argc' => 3,
|
||||
],
|
||||
'server' => [
|
||||
'QUERY_STRING' => 'pagename=u/test/it?arg1=value1&arg2=value2',
|
||||
'QUERY_STRING' => 'pagename=u/test/it&arg1=value1&arg2=value2',
|
||||
],
|
||||
'get' => [
|
||||
'pagename' => 'u/test/it',
|
||||
|
@ -126,13 +98,13 @@ class ArgumentsTest extends TestCase
|
|||
],
|
||||
'withTrailingSlash' => [
|
||||
'assert' => [
|
||||
'queryString' => 'profile/test/it?arg1=value1&arg2=value2/',
|
||||
'queryString' => 'profile/test/it?arg1=value1&arg2=value2%2F',
|
||||
'command' => 'profile/test/it',
|
||||
'argv' => ['profile', 'test', 'it'],
|
||||
'argc' => 3,
|
||||
],
|
||||
'server' => [
|
||||
'QUERY_STRING' => 'pagename=profile/test/it?arg1=value1&arg2=value2/',
|
||||
'QUERY_STRING' => 'pagename=profile/test/it&arg1=value1&arg2=value2/',
|
||||
],
|
||||
'get' => [
|
||||
'pagename' => 'profile/test/it',
|
||||
|
@ -140,14 +112,13 @@ class ArgumentsTest extends TestCase
|
|||
],
|
||||
'withWrongQueryString' => [
|
||||
'assert' => [
|
||||
// empty query string?!
|
||||
'queryString' => '',
|
||||
'queryString' => 'profile/test/it?wrong=profile%2Ftest%2Fit&arg1=value1&arg2=value2%2F',
|
||||
'command' => 'profile/test/it',
|
||||
'argv' => ['profile', 'test', 'it'],
|
||||
'argc' => 3,
|
||||
],
|
||||
'server' => [
|
||||
'QUERY_STRING' => 'wrong=profile/test/it?arg1=value1&arg2=value2/',
|
||||
'QUERY_STRING' => 'wrong=profile/test/it&arg1=value1&arg2=value2/',
|
||||
],
|
||||
'get' => [
|
||||
'pagename' => 'profile/test/it',
|
||||
|
@ -155,17 +126,44 @@ class ArgumentsTest extends TestCase
|
|||
],
|
||||
'withMissingPageName' => [
|
||||
'assert' => [
|
||||
'queryString' => 'notvalid/it?arg1=value1&arg2=value2/',
|
||||
'command' => App\Module::DEFAULT,
|
||||
'argv' => [App\Module::DEFAULT],
|
||||
'argc' => 1,
|
||||
'queryString' => 'notvalid/it?arg1=value1&arg2=value2%2F',
|
||||
'command' => 'notvalid/it',
|
||||
'argv' => ['notvalid', 'it'],
|
||||
'argc' => 2,
|
||||
],
|
||||
'server' => [
|
||||
'QUERY_STRING' => 'pagename=notvalid/it?arg1=value1&arg2=value2/',
|
||||
'QUERY_STRING' => 'pagename=notvalid/it&arg1=value1&arg2=value2/',
|
||||
],
|
||||
'get' => [
|
||||
],
|
||||
],
|
||||
'withNothing' => [
|
||||
'assert' => [
|
||||
'queryString' => '?arg1=value1&arg2=value2%2F',
|
||||
'command' => '',
|
||||
'argv' => [],
|
||||
'argc' => 0,
|
||||
],
|
||||
'server' => [
|
||||
'QUERY_STRING' => 'arg1=value1&arg2=value2/',
|
||||
],
|
||||
'get' => [
|
||||
],
|
||||
],
|
||||
'withFileExtension' => [
|
||||
'assert' => [
|
||||
'queryString' => 'api/call.json',
|
||||
'command' => 'api/call.json',
|
||||
'argv' => ['api', 'call.json'],
|
||||
'argc' => 2,
|
||||
],
|
||||
'server' => [
|
||||
'QUERY_STRING' => 'pagename=api/call.json',
|
||||
],
|
||||
'get' => [
|
||||
'pagename' => 'api/call.json'
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -207,27 +205,27 @@ class ArgumentsTest extends TestCase
|
|||
return [
|
||||
'strippedZRLFirst' => [
|
||||
'assert' => '?arg1=value1',
|
||||
'input' => '?zrl=nope&arg1=value1',
|
||||
'input' => '&zrl=nope&arg1=value1',
|
||||
],
|
||||
'strippedZRLLast' => [
|
||||
'assert' => '?arg1=value1',
|
||||
'input' => '?arg1=value1&zrl=nope',
|
||||
'input' => '&arg1=value1&zrl=nope',
|
||||
],
|
||||
'strippedZTLMiddle' => [
|
||||
'assert' => '?arg1=value1&arg2=value2',
|
||||
'input' => '?arg1=value1&zrl=nope&arg2=value2',
|
||||
'input' => '&arg1=value1&zrl=nope&arg2=value2',
|
||||
],
|
||||
'strippedOWTFirst' => [
|
||||
'assert' => '?arg1=value1',
|
||||
'input' => '?owt=test&arg1=value1',
|
||||
'input' => '&owt=test&arg1=value1',
|
||||
],
|
||||
'strippedOWTLast' => [
|
||||
'assert' => '?arg1=value1',
|
||||
'input' => '?arg1=value1&owt=test',
|
||||
'input' => '&arg1=value1&owt=test',
|
||||
],
|
||||
'strippedOWTMiddle' => [
|
||||
'assert' => '?arg1=value1&arg2=value2',
|
||||
'input' => '?arg1=value1&owt=test&arg2=value2',
|
||||
'input' => '&arg1=value1&owt=test&arg2=value2',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
@ -242,7 +240,7 @@ class ArgumentsTest extends TestCase
|
|||
$command = 'test/it';
|
||||
|
||||
$arguments = (new App\Arguments())
|
||||
->determine(['QUERY_STRING' => 'q=' . $command . $input,], ['pagename' => $command]);
|
||||
->determine(['QUERY_STRING' => 'pagename=' . $command . $input,], ['pagename' => $command]);
|
||||
|
||||
$this->assertEquals($command . $assert, $arguments->getQueryString());
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
namespace Friendica\Test\Content\Text\BBCode;
|
||||
namespace Friendica\Test\src\Content\Text\BBCode;
|
||||
|
||||
use Friendica\Content\Text\BBCode\Video;
|
||||
use Friendica\Test\MockedTest;
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
namespace Friendica\Test\src\Core\L10n;
|
||||
namespace Friendica\Test\src\Core;
|
||||
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Test\MockedTest;
|
||||
|
|
|
@ -234,7 +234,7 @@ class ContactEndpointTest extends FixtureTest
|
|||
'uid' => 42,
|
||||
'cid' => 44,
|
||||
'pid' => 45,
|
||||
'self' => 0,
|
||||
'self' => false,
|
||||
'network' => 'dfrn',
|
||||
'statusnet_profile_url' => 'http://localhost/profile/friendcontact',
|
||||
];
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
namespace Friendica\Test\Protocol;
|
||||
namespace Friendica\Test\src\Protocol;
|
||||
|
||||
use Friendica\Protocol\Activity;
|
||||
use Friendica\Protocol\ActivityNamespace;
|
||||
|
|
|
@ -61,7 +61,7 @@ class MailBuilderTest extends MockedTest
|
|||
$this->baseUrl->shouldReceive('getHostname')->andReturn('friendica.local');
|
||||
$this->baseUrl->shouldReceive('get')->andReturn('http://friendica.local');
|
||||
|
||||
$this->defaultHeaders = "";
|
||||
$this->defaultHeaders = [];
|
||||
}
|
||||
|
||||
public function assertEmail(IEmail $email, array $asserts)
|
||||
|
|
|
@ -41,7 +41,7 @@ class SystemMailBuilderTest extends MockedTest
|
|||
/** @var BaseURL */
|
||||
private $baseUrl;
|
||||
|
||||
/** @var string */
|
||||
/** @var string[] */
|
||||
private $defaultHeaders;
|
||||
|
||||
public function setUp()
|
||||
|
@ -60,7 +60,7 @@ class SystemMailBuilderTest extends MockedTest
|
|||
$this->baseUrl->shouldReceive('getHostname')->andReturn('friendica.local');
|
||||
$this->baseUrl->shouldReceive('get')->andReturn('http://friendica.local');
|
||||
|
||||
$this->defaultHeaders = "";
|
||||
$this->defaultHeaders = [];
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue