mirror of
https://github.com/friendica/friendica
synced 2024-12-22 01:20:15 +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()
|
||||
{
|
||||
// This call is needed for this test
|
||||
// @todo: This call is needed for this test
|
||||
Renderer::registerTemplateEngine('Friendica\Render\FriendicaSmartyEngine');
|
||||
|
||||
$posts = DI::dba()->selectToArray('post-view', ['uri-id']);
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
namespace Friendica\Test\src\Module\Api\Twitter;
|
||||
|
||||
use Friendica\Capabilities\ICanCreateResponses;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\DI;
|
||||
use Friendica\Module\Api\Twitter\Favorites;
|
||||
use Friendica\Test\ApiTestCase;
|
||||
|
@ -21,7 +22,10 @@ class FavoritesTest extends ApiTestCase
|
|||
*/
|
||||
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, [
|
||||
'page' => -1,
|
||||
'max_id' => 10,
|
||||
|
@ -41,7 +45,10 @@ class FavoritesTest extends ApiTestCase
|
|||
*/
|
||||
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
|
||||
]))->run($this->httpExceptionMock);
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
namespace Friendica\Test\src\Module\Api\Twitter\Lists;
|
||||
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\DI;
|
||||
use Friendica\Module\Api\Twitter\Lists\Statuses;
|
||||
use Friendica\Network\HTTPException\BadRequestException;
|
||||
|
@ -32,7 +33,10 @@ class StatusesTest extends ApiTestCase
|
|||
*/
|
||||
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, [
|
||||
'list_id' => 1,
|
||||
'page' => -1,
|
||||
|
@ -52,7 +56,10 @@ class StatusesTest extends ApiTestCase
|
|||
*/
|
||||
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, [
|
||||
'list_id' => 1
|
||||
]);
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
namespace Friendica\Test\src\Module\Api\Twitter\Statuses;
|
||||
|
||||
use Friendica\Capabilities\ICanCreateResponses;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\DI;
|
||||
use Friendica\Module\Api\Twitter\Statuses\NetworkPublicTimeline;
|
||||
use Friendica\Test\ApiTestCase;
|
||||
|
@ -21,7 +22,10 @@ class NetworkPublicTimelineTest extends ApiTestCase
|
|||
*/
|
||||
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, [
|
||||
'max_id' => 10
|
||||
]);
|
||||
|
@ -43,7 +47,10 @@ class NetworkPublicTimelineTest extends ApiTestCase
|
|||
*/
|
||||
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, [
|
||||
'page' => -2
|
||||
]);
|
||||
|
@ -79,7 +86,10 @@ class NetworkPublicTimelineTest extends ApiTestCase
|
|||
*/
|
||||
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
|
||||
]))->run($this->httpExceptionMock, [
|
||||
'page' => -2
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
namespace Friendica\Test\src\Module\Api\Twitter\Statuses;
|
||||
|
||||
use Friendica\App\Router;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\DI;
|
||||
use Friendica\Module\Api\Twitter\Statuses\Retweet;
|
||||
use Friendica\Network\HTTPException\BadRequestException;
|
||||
|
@ -74,7 +75,10 @@ class RetweetTest extends ApiTestCase
|
|||
*/
|
||||
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, [
|
||||
'id' => 5
|
||||
]);
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
namespace Friendica\Test\src\Module\Api\Twitter\Statuses;
|
||||
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\DI;
|
||||
use Friendica\Module\Api\Twitter\Statuses\Show;
|
||||
use Friendica\Network\HTTPException\BadRequestException;
|
||||
|
@ -53,7 +54,10 @@ class ShowTest extends ApiTestCase
|
|||
*/
|
||||
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, [
|
||||
'id' => 1,
|
||||
'conversation' => 1
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
namespace Friendica\Test\src\Module\Api\Twitter\Statuses;
|
||||
|
||||
use Friendica\Capabilities\ICanCreateResponses;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\DI;
|
||||
use Friendica\Module\Api\Twitter\Statuses\UserTimeline;
|
||||
use Friendica\Test\ApiTestCase;
|
||||
|
@ -46,7 +47,10 @@ class UserTimelineTest extends ApiTestCase
|
|||
*/
|
||||
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, [
|
||||
'user_id' => 43, // Public contact id
|
||||
'page' => -2,
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
namespace Friendica\Test\src\Module\Api\Twitter\Users;
|
||||
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\DI;
|
||||
use Friendica\Module\Api\Twitter\Users\Lookup;
|
||||
use Friendica\Network\HTTPException\NotFoundException;
|
||||
|
@ -34,7 +35,10 @@ class LookupTest extends ApiTestCase
|
|||
*/
|
||||
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, [
|
||||
'user_id' => static::OTHER_USER['id']
|
||||
]);
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
namespace Friendica\Test\src\Module\Api\Twitter\Users;
|
||||
|
||||
use Friendica\Capabilities\ICanCreateResponses;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\DI;
|
||||
use Friendica\Module\Api\Twitter\Users\Search;
|
||||
use Friendica\Network\HTTPException\BadRequestException;
|
||||
|
@ -22,7 +23,10 @@ class SearchTest extends ApiTestCase
|
|||
*/
|
||||
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, [
|
||||
'q' => static::OTHER_USER['name']
|
||||
]);
|
||||
|
@ -39,7 +43,10 @@ class SearchTest extends ApiTestCase
|
|||
*/
|
||||
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
|
||||
]))->run($this->httpExceptionMock, [
|
||||
'q' => static::OTHER_USER['name']
|
||||
|
|
Loading…
Reference in a new issue