]> git.mxchange.org Git - friendica.git/blobdiff - tests/ApiTest.php
Removing debugging echo
[friendica.git] / tests / ApiTest.php
index 1854c996b0ffbd258e369775744431efca10912b..cbc6f7e0b4412a0e196e78259bd2c2d56cb5d8a8 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,18 @@ class ApiTest extends DatabaseTest
                Config::set('system', 'theme', 'system_theme');
        }
 
+       /**
+        * Cleanup variables used by tests.
+        */
+       protected function tearDown()
+       {
+               parent::tearDown();
+
+               $app = get_app();
+               $app->argc = 1;
+               $app->argv = ['home'];
+       }
+
        /**
         * Assert that an user array contains expected keys.
         * @param array $user User array
@@ -1202,7 +1214,8 @@ class ApiTest extends DatabaseTest
        {
                $_FILES = [
                        'media' => [
-                               'id' => 666
+                               'id' => 666,
+                               'tmp_name' => 'tmp_name'
                        ]
                ];
                api_media_upload();
@@ -3374,7 +3387,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);
        }