]> git.mxchange.org Git - friendica.git/blobdiff - tests/ApiTest.php
Merge pull request #5862 from nupplaphil/rename_App_Methods
[friendica.git] / tests / ApiTest.php
index 4e272901955b6197f388aec13d14b4906a302c85..11c61f9fbb40a46990838ddbd6534d58ad4e1b6b 100644 (file)
@@ -5,6 +5,7 @@
 
 namespace Friendica\Test;
 
+use Friendica\BaseObject;
 use Friendica\Core\Config;
 use Friendica\Core\PConfig;
 use Friendica\Core\Protocol;
@@ -23,12 +24,11 @@ class ApiTest extends DatabaseTest
        /**
         * Create variables used by tests.
         */
-       protected function setUp()
+       public function setUp()
        {
                parent::setUp();
 
-               // Reusable App object
-               $this->app = \Friendica\BaseObject::getApp();
+               require_once __DIR__.'/../include/api.php';
 
                // User data that the test database is populated with
                $this->selfUser = [
@@ -68,6 +68,17 @@ class ApiTest extends DatabaseTest
                Config::set('system', 'theme', 'system_theme');
        }
 
+       /**
+        * Cleanup variables used by tests.
+        */
+       protected function tearDown()
+       {
+               parent::tearDown();
+
+               $this->app->argc = 1;
+               $this->app->argv = ['home'];
+       }
+
        /**
         * Assert that an user array contains expected keys.
         * @param array $user User array
@@ -3375,7 +3386,7 @@ class ApiTest extends DatabaseTest
         */
        public function testApiShareAsRetweet()
        {
-               $item = ['body' => ''];
+               $item = ['body' => '', 'author-id' => 1, 'owner-id' => 1];
                $result = api_share_as_retweet($item);
                $this->assertFalse($result);
        }