Introduce new DI container

- Adding Friendica\DI class for getting dynamic classes
- Replacing BaseObject::getApp() with this class
This commit is contained in:
Philipp Holzer 2019-12-15 22:34:11 +01:00
commit 1de3f186d7
No known key found for this signature in database
GPG key ID: D8365C3D36B77D90
132 changed files with 377 additions and 270 deletions

View file

@ -15,6 +15,7 @@ use Friendica\Core\Session;
use Friendica\Core\Session\ISession;
use Friendica\Core\System;
use Friendica\Database\Database;
use Friendica\DI;
use Friendica\Model\Contact;
use Friendica\Network\HTTPException;
use Friendica\Test\Util\Database\StaticDatabase;
@ -87,7 +88,7 @@ class ApiTest extends DatabaseTest
$this->loadFixture(__DIR__ . '/../datasets/api.fixture.php', $dba);
/** @var App app */
$this->app = BaseObject::getApp();
$this->app = DI::app();
$this->app->argc = 1;
$this->app->argv = ['home'];

View file

@ -1,36 +0,0 @@
<?php
/**
* BaseObjectTest class.
*/
namespace Friendica\Test\src;
use Friendica\BaseObject;
use Friendica\Test\Util\AppMockTrait;
use Friendica\Test\Util\VFSTrait;
use PHPUnit\Framework\TestCase;
/**
* Tests for the BaseObject class.
*/
class BaseObjectTest extends TestCase
{
use VFSTrait;
use AppMockTrait;
/**
* @var BaseObject
*/
private $baseObject;
/**
* Test the getApp() function without App
* @expectedException Friendica\Network\HTTPException\InternalServerErrorException
* @runInSeparateProcess
* @preserveGlobalState disabled
*/
public function testGetAppFailed()
{
BaseObject::getApp();
}
}