]> git.mxchange.org Git - friendica.git/blobdiff - tests/ApiTest.php
Bugfixing executable (Mocking the executable)
[friendica.git] / tests / ApiTest.php
index cbc6f7e0b4412a0e196e78259bd2c2d56cb5d8a8..c509c7d2a4233b3ea69ab5b7a6d823246ae357da 100644 (file)
@@ -12,6 +12,8 @@ use Friendica\Core\Protocol;
 use Friendica\Core\System;
 use Friendica\Network\HTTPException;
 
+require_once __DIR__ . '/../include/api.php';
+
 /**
  * Tests for the API functions.
  *
@@ -20,7 +22,6 @@ use Friendica\Network\HTTPException;
  */
 class ApiTest extends DatabaseTest
 {
-
        /**
         * Create variables used by tests.
         */
@@ -28,7 +29,7 @@ class ApiTest extends DatabaseTest
        {
                parent::setUp();
 
-               require_once __DIR__.'/../include/api.php';
+               $this->app = BaseObject::getApp();
 
                // User data that the test database is populated with
                $this->selfUser = [
@@ -60,6 +61,10 @@ class ApiTest extends DatabaseTest
                        'uid' => $this->selfUser['id']
                ];
 
+               Config::set('system', 'url', 'http://localhost');
+               Config::set('system', 'hostname', 'localhost');
+               Config::set('system', 'worker_dont_fork', true);
+
                // Default config
                Config::set('config', 'hostname', 'localhost');
                Config::set('system', 'throttle_limit_day', 100);
@@ -75,9 +80,8 @@ class ApiTest extends DatabaseTest
        {
                parent::tearDown();
 
-               $app = get_app();
-               $app->argc = 1;
-               $app->argv = ['home'];
+               $this->app->argc = 1;
+               $this->app->argv = ['home'];
        }
 
        /**
@@ -3375,7 +3379,7 @@ class ApiTest extends DatabaseTest
         */
        public function testApiFriendicaRemoteauthWithCorrectUrl()
        {
-               $this->markTestIncomplete("We can't use an assertion here because of goaway().");
+               $this->markTestIncomplete("We can't use an assertion here because of App->redirect().");
                $_GET['url'] = 'url';
                $_GET['c_url'] = $this->selfUser['nurl'];
                api_friendica_remoteauth();