namespace Friendica\Test;
+use Friendica\BaseObject;
use Friendica\Core\Config;
use Friendica\Core\PConfig;
use Friendica\Core\Protocol;
use Friendica\Core\System;
use Friendica\Network\HTTPException;
+require_once __DIR__ . '/../include/api.php';
+
/**
* Tests for the API functions.
*
*/
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();
+ $this->app = BaseObject::getApp();
// User data that the test database is populated with
$this->selfUser = [
'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);
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
*/
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();
*/
public function testApiShareAsRetweet()
{
- $item = ['body' => ''];
+ $item = ['body' => '', 'author-id' => 1, 'owner-id' => 1];
$result = api_share_as_retweet($item);
$this->assertFalse($result);
}