mirror of
https://github.com/friendica/friendica
synced 2024-12-22 12:00:17 +00:00
replace more calls of DI::app(), add workaround for tests
This commit is contained in:
parent
ba65cad1cd
commit
a583cc9b0e
9 changed files with 61 additions and 14 deletions
|
@ -124,7 +124,7 @@ class StatusTest extends FixtureTestCase
|
||||||
*/
|
*/
|
||||||
public function testApiFormatItems()
|
public function testApiFormatItems()
|
||||||
{
|
{
|
||||||
// This call is needed for this test
|
// @todo: This call is needed for this test
|
||||||
Renderer::registerTemplateEngine('Friendica\Render\FriendicaSmartyEngine');
|
Renderer::registerTemplateEngine('Friendica\Render\FriendicaSmartyEngine');
|
||||||
|
|
||||||
$posts = DI::dba()->selectToArray('post-view', ['uri-id']);
|
$posts = DI::dba()->selectToArray('post-view', ['uri-id']);
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
namespace Friendica\Test\src\Module\Api\Twitter;
|
namespace Friendica\Test\src\Module\Api\Twitter;
|
||||||
|
|
||||||
use Friendica\Capabilities\ICanCreateResponses;
|
use Friendica\Capabilities\ICanCreateResponses;
|
||||||
|
use Friendica\Core\Renderer;
|
||||||
use Friendica\DI;
|
use Friendica\DI;
|
||||||
use Friendica\Module\Api\Twitter\Favorites;
|
use Friendica\Module\Api\Twitter\Favorites;
|
||||||
use Friendica\Test\ApiTestCase;
|
use Friendica\Test\ApiTestCase;
|
||||||
|
@ -21,7 +22,10 @@ class FavoritesTest extends ApiTestCase
|
||||||
*/
|
*/
|
||||||
public function testApiFavorites()
|
public function testApiFavorites()
|
||||||
{
|
{
|
||||||
$response = (new Favorites(DI::mstdnError(), DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), []))
|
// @todo: This call is needed for this test
|
||||||
|
Renderer::registerTemplateEngine('Friendica\Render\FriendicaSmartyEngine');
|
||||||
|
|
||||||
|
$response = (new Favorites(DI::mstdnError(), DI::appHelper(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), []))
|
||||||
->run($this->httpExceptionMock, [
|
->run($this->httpExceptionMock, [
|
||||||
'page' => -1,
|
'page' => -1,
|
||||||
'max_id' => 10,
|
'max_id' => 10,
|
||||||
|
@ -41,7 +45,10 @@ class FavoritesTest extends ApiTestCase
|
||||||
*/
|
*/
|
||||||
public function testApiFavoritesWithRss()
|
public function testApiFavoritesWithRss()
|
||||||
{
|
{
|
||||||
$response = (new Favorites(DI::mstdnError(), DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), [], [
|
// @todo: This call is needed for this test
|
||||||
|
Renderer::registerTemplateEngine('Friendica\Render\FriendicaSmartyEngine');
|
||||||
|
|
||||||
|
$response = (new Favorites(DI::mstdnError(), DI::appHelper(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), [], [
|
||||||
'extension' => ICanCreateResponses::TYPE_RSS
|
'extension' => ICanCreateResponses::TYPE_RSS
|
||||||
]))->run($this->httpExceptionMock);
|
]))->run($this->httpExceptionMock);
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
|
|
||||||
namespace Friendica\Test\src\Module\Api\Twitter\Lists;
|
namespace Friendica\Test\src\Module\Api\Twitter\Lists;
|
||||||
|
|
||||||
|
use Friendica\Core\Renderer;
|
||||||
use Friendica\DI;
|
use Friendica\DI;
|
||||||
use Friendica\Module\Api\Twitter\Lists\Statuses;
|
use Friendica\Module\Api\Twitter\Lists\Statuses;
|
||||||
use Friendica\Network\HTTPException\BadRequestException;
|
use Friendica\Network\HTTPException\BadRequestException;
|
||||||
|
@ -32,7 +33,10 @@ class StatusesTest extends ApiTestCase
|
||||||
*/
|
*/
|
||||||
public function testApiListsStatusesWithListId()
|
public function testApiListsStatusesWithListId()
|
||||||
{
|
{
|
||||||
$response = (new Statuses(DI::dba(), DI::twitterStatus(), DI::mstdnError(), DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), []))
|
// @todo: This call is needed for this test
|
||||||
|
Renderer::registerTemplateEngine('Friendica\Render\FriendicaSmartyEngine');
|
||||||
|
|
||||||
|
$response = (new Statuses(DI::dba(), DI::twitterStatus(), DI::mstdnError(), DI::appHelper(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), []))
|
||||||
->run($this->httpExceptionMock, [
|
->run($this->httpExceptionMock, [
|
||||||
'list_id' => 1,
|
'list_id' => 1,
|
||||||
'page' => -1,
|
'page' => -1,
|
||||||
|
@ -52,7 +56,10 @@ class StatusesTest extends ApiTestCase
|
||||||
*/
|
*/
|
||||||
public function testApiListsStatusesWithListIdAndRss()
|
public function testApiListsStatusesWithListIdAndRss()
|
||||||
{
|
{
|
||||||
$response = (new Statuses(DI::dba(), DI::twitterStatus(), DI::mstdnError(), DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), [], ['extension' => 'rss']))
|
// @todo: This call is needed for this test
|
||||||
|
Renderer::registerTemplateEngine('Friendica\Render\FriendicaSmartyEngine');
|
||||||
|
|
||||||
|
$response = (new Statuses(DI::dba(), DI::twitterStatus(), DI::mstdnError(), DI::appHelper(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), [], ['extension' => 'rss']))
|
||||||
->run($this->httpExceptionMock, [
|
->run($this->httpExceptionMock, [
|
||||||
'list_id' => 1
|
'list_id' => 1
|
||||||
]);
|
]);
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
namespace Friendica\Test\src\Module\Api\Twitter\Statuses;
|
namespace Friendica\Test\src\Module\Api\Twitter\Statuses;
|
||||||
|
|
||||||
use Friendica\Capabilities\ICanCreateResponses;
|
use Friendica\Capabilities\ICanCreateResponses;
|
||||||
|
use Friendica\Core\Renderer;
|
||||||
use Friendica\DI;
|
use Friendica\DI;
|
||||||
use Friendica\Module\Api\Twitter\Statuses\NetworkPublicTimeline;
|
use Friendica\Module\Api\Twitter\Statuses\NetworkPublicTimeline;
|
||||||
use Friendica\Test\ApiTestCase;
|
use Friendica\Test\ApiTestCase;
|
||||||
|
@ -21,7 +22,10 @@ class NetworkPublicTimelineTest extends ApiTestCase
|
||||||
*/
|
*/
|
||||||
public function testApiStatusesNetworkpublicTimeline()
|
public function testApiStatusesNetworkpublicTimeline()
|
||||||
{
|
{
|
||||||
$response = (new NetworkPublicTimeline(DI::mstdnError(), DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), []))
|
// @todo: This call is needed for this test
|
||||||
|
Renderer::registerTemplateEngine('Friendica\Render\FriendicaSmartyEngine');
|
||||||
|
|
||||||
|
$response = (new NetworkPublicTimeline(DI::mstdnError(), DI::appHelper(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), []))
|
||||||
->run($this->httpExceptionMock, [
|
->run($this->httpExceptionMock, [
|
||||||
'max_id' => 10
|
'max_id' => 10
|
||||||
]);
|
]);
|
||||||
|
@ -43,7 +47,10 @@ class NetworkPublicTimelineTest extends ApiTestCase
|
||||||
*/
|
*/
|
||||||
public function testApiStatusesNetworkpublicTimelineWithNegativePage()
|
public function testApiStatusesNetworkpublicTimelineWithNegativePage()
|
||||||
{
|
{
|
||||||
$response = (new NetworkPublicTimeline(DI::mstdnError(), DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), []))
|
// @todo: This call is needed for this test
|
||||||
|
Renderer::registerTemplateEngine('Friendica\Render\FriendicaSmartyEngine');
|
||||||
|
|
||||||
|
$response = (new NetworkPublicTimeline(DI::mstdnError(), DI::appHelper(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), []))
|
||||||
->run($this->httpExceptionMock, [
|
->run($this->httpExceptionMock, [
|
||||||
'page' => -2
|
'page' => -2
|
||||||
]);
|
]);
|
||||||
|
@ -79,7 +86,10 @@ class NetworkPublicTimelineTest extends ApiTestCase
|
||||||
*/
|
*/
|
||||||
public function testApiStatusesNetworkpublicTimelineWithRss()
|
public function testApiStatusesNetworkpublicTimelineWithRss()
|
||||||
{
|
{
|
||||||
$response = (new NetworkPublicTimeline(DI::mstdnError(), DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), [], [
|
// @todo: This call is needed for this test
|
||||||
|
Renderer::registerTemplateEngine('Friendica\Render\FriendicaSmartyEngine');
|
||||||
|
|
||||||
|
$response = (new NetworkPublicTimeline(DI::mstdnError(), DI::appHelper(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), [], [
|
||||||
'extension' => ICanCreateResponses::TYPE_RSS
|
'extension' => ICanCreateResponses::TYPE_RSS
|
||||||
]))->run($this->httpExceptionMock, [
|
]))->run($this->httpExceptionMock, [
|
||||||
'page' => -2
|
'page' => -2
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
namespace Friendica\Test\src\Module\Api\Twitter\Statuses;
|
namespace Friendica\Test\src\Module\Api\Twitter\Statuses;
|
||||||
|
|
||||||
use Friendica\App\Router;
|
use Friendica\App\Router;
|
||||||
|
use Friendica\Core\Renderer;
|
||||||
use Friendica\DI;
|
use Friendica\DI;
|
||||||
use Friendica\Module\Api\Twitter\Statuses\Retweet;
|
use Friendica\Module\Api\Twitter\Statuses\Retweet;
|
||||||
use Friendica\Network\HTTPException\BadRequestException;
|
use Friendica\Network\HTTPException\BadRequestException;
|
||||||
|
@ -74,7 +75,10 @@ class RetweetTest extends ApiTestCase
|
||||||
*/
|
*/
|
||||||
public function testApiStatusesRepeatWithSharedId()
|
public function testApiStatusesRepeatWithSharedId()
|
||||||
{
|
{
|
||||||
$response = (new Retweet(DI::mstdnError(), DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), []))
|
// @todo: This call is needed for this test
|
||||||
|
Renderer::registerTemplateEngine('Friendica\Render\FriendicaSmartyEngine');
|
||||||
|
|
||||||
|
$response = (new Retweet(DI::mstdnError(), DI::appHelper(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), []))
|
||||||
->run($this->httpExceptionMock, [
|
->run($this->httpExceptionMock, [
|
||||||
'id' => 5
|
'id' => 5
|
||||||
]);
|
]);
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
|
|
||||||
namespace Friendica\Test\src\Module\Api\Twitter\Statuses;
|
namespace Friendica\Test\src\Module\Api\Twitter\Statuses;
|
||||||
|
|
||||||
|
use Friendica\Core\Renderer;
|
||||||
use Friendica\DI;
|
use Friendica\DI;
|
||||||
use Friendica\Module\Api\Twitter\Statuses\Show;
|
use Friendica\Module\Api\Twitter\Statuses\Show;
|
||||||
use Friendica\Network\HTTPException\BadRequestException;
|
use Friendica\Network\HTTPException\BadRequestException;
|
||||||
|
@ -53,7 +54,10 @@ class ShowTest extends ApiTestCase
|
||||||
*/
|
*/
|
||||||
public function testApiStatusesShowWithConversation()
|
public function testApiStatusesShowWithConversation()
|
||||||
{
|
{
|
||||||
$response = (new Show(DI::mstdnError(), DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), []))
|
// @todo: This call is needed for this test
|
||||||
|
Renderer::registerTemplateEngine('Friendica\Render\FriendicaSmartyEngine');
|
||||||
|
|
||||||
|
$response = (new Show(DI::mstdnError(), DI::appHelper(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), []))
|
||||||
->run($this->httpExceptionMock, [
|
->run($this->httpExceptionMock, [
|
||||||
'id' => 1,
|
'id' => 1,
|
||||||
'conversation' => 1
|
'conversation' => 1
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
namespace Friendica\Test\src\Module\Api\Twitter\Statuses;
|
namespace Friendica\Test\src\Module\Api\Twitter\Statuses;
|
||||||
|
|
||||||
use Friendica\Capabilities\ICanCreateResponses;
|
use Friendica\Capabilities\ICanCreateResponses;
|
||||||
|
use Friendica\Core\Renderer;
|
||||||
use Friendica\DI;
|
use Friendica\DI;
|
||||||
use Friendica\Module\Api\Twitter\Statuses\UserTimeline;
|
use Friendica\Module\Api\Twitter\Statuses\UserTimeline;
|
||||||
use Friendica\Test\ApiTestCase;
|
use Friendica\Test\ApiTestCase;
|
||||||
|
@ -46,7 +47,10 @@ class UserTimelineTest extends ApiTestCase
|
||||||
*/
|
*/
|
||||||
public function testApiStatusesUserTimelineWithNegativePage()
|
public function testApiStatusesUserTimelineWithNegativePage()
|
||||||
{
|
{
|
||||||
$response = (new UserTimeline(DI::mstdnError(), DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), []))
|
// @todo: This call is needed for this test
|
||||||
|
Renderer::registerTemplateEngine('Friendica\Render\FriendicaSmartyEngine');
|
||||||
|
|
||||||
|
$response = (new UserTimeline(DI::mstdnError(), DI::appHelper(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), []))
|
||||||
->run($this->httpExceptionMock, [
|
->run($this->httpExceptionMock, [
|
||||||
'user_id' => 43, // Public contact id
|
'user_id' => 43, // Public contact id
|
||||||
'page' => -2,
|
'page' => -2,
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
|
|
||||||
namespace Friendica\Test\src\Module\Api\Twitter\Users;
|
namespace Friendica\Test\src\Module\Api\Twitter\Users;
|
||||||
|
|
||||||
|
use Friendica\Core\Renderer;
|
||||||
use Friendica\DI;
|
use Friendica\DI;
|
||||||
use Friendica\Module\Api\Twitter\Users\Lookup;
|
use Friendica\Module\Api\Twitter\Users\Lookup;
|
||||||
use Friendica\Network\HTTPException\NotFoundException;
|
use Friendica\Network\HTTPException\NotFoundException;
|
||||||
|
@ -34,7 +35,10 @@ class LookupTest extends ApiTestCase
|
||||||
*/
|
*/
|
||||||
public function testApiUsersLookupWithUserId()
|
public function testApiUsersLookupWithUserId()
|
||||||
{
|
{
|
||||||
$response = (new Lookup(DI::mstdnError(), DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), []))
|
// @todo: This call is needed for this test
|
||||||
|
Renderer::registerTemplateEngine('Friendica\Render\FriendicaSmartyEngine');
|
||||||
|
|
||||||
|
$response = (new Lookup(DI::mstdnError(), DI::appHelper(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), []))
|
||||||
->run($this->httpExceptionMock, [
|
->run($this->httpExceptionMock, [
|
||||||
'user_id' => static::OTHER_USER['id']
|
'user_id' => static::OTHER_USER['id']
|
||||||
]);
|
]);
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
namespace Friendica\Test\src\Module\Api\Twitter\Users;
|
namespace Friendica\Test\src\Module\Api\Twitter\Users;
|
||||||
|
|
||||||
use Friendica\Capabilities\ICanCreateResponses;
|
use Friendica\Capabilities\ICanCreateResponses;
|
||||||
|
use Friendica\Core\Renderer;
|
||||||
use Friendica\DI;
|
use Friendica\DI;
|
||||||
use Friendica\Module\Api\Twitter\Users\Search;
|
use Friendica\Module\Api\Twitter\Users\Search;
|
||||||
use Friendica\Network\HTTPException\BadRequestException;
|
use Friendica\Network\HTTPException\BadRequestException;
|
||||||
|
@ -22,7 +23,10 @@ class SearchTest extends ApiTestCase
|
||||||
*/
|
*/
|
||||||
public function testApiUsersSearch()
|
public function testApiUsersSearch()
|
||||||
{
|
{
|
||||||
$response = (new Search(DI::mstdnError(), DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), []))
|
// @todo: This call is needed for this test
|
||||||
|
Renderer::registerTemplateEngine('Friendica\Render\FriendicaSmartyEngine');
|
||||||
|
|
||||||
|
$response = (new Search(DI::mstdnError(), DI::appHelper(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), []))
|
||||||
->run($this->httpExceptionMock, [
|
->run($this->httpExceptionMock, [
|
||||||
'q' => static::OTHER_USER['name']
|
'q' => static::OTHER_USER['name']
|
||||||
]);
|
]);
|
||||||
|
@ -39,7 +43,10 @@ class SearchTest extends ApiTestCase
|
||||||
*/
|
*/
|
||||||
public function testApiUsersSearchWithXml()
|
public function testApiUsersSearchWithXml()
|
||||||
{
|
{
|
||||||
$response = (new Search(DI::mstdnError(), DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), [], [
|
// @todo: This call is needed for this test
|
||||||
|
Renderer::registerTemplateEngine('Friendica\Render\FriendicaSmartyEngine');
|
||||||
|
|
||||||
|
$response = (new Search(DI::mstdnError(), DI::appHelper(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), [], [
|
||||||
'extension' => ICanCreateResponses::TYPE_XML
|
'extension' => ICanCreateResponses::TYPE_XML
|
||||||
]))->run($this->httpExceptionMock, [
|
]))->run($this->httpExceptionMock, [
|
||||||
'q' => static::OTHER_USER['name']
|
'q' => static::OTHER_USER['name']
|
||||||
|
|
Loading…
Reference in a new issue