]> git.mxchange.org Git - friendica.git/commitdiff
Fixing tests
authorPhilipp Holzer <admin@philipp.info>
Tue, 5 Feb 2019 21:03:07 +0000 (22:03 +0100)
committerPhilipp Holzer <admin@philipp.info>
Tue, 5 Feb 2019 21:03:07 +0000 (22:03 +0100)
tests/include/ApiTest.php
tests/src/Database/DBATest.php
tests/src/Database/DBStructureTest.php

index 9cf3e2ea5de18871dc60dcc1035fdc0e4a631360..be70d923bd4866c42e3f084cf4a543cb5ef72f2a 100644 (file)
@@ -5,13 +5,14 @@
 
 namespace Friendica\Test;
 
-use Friendica\BaseObject;
+use Friendica\App;
 use Friendica\Core\Config;
 use Friendica\Core\PConfig;
 use Friendica\Core\Protocol;
 use Friendica\Core\System;
-use Friendica\Factory\LoggerFactory;
+use Friendica\Factory;
 use Friendica\Network\HTTPException;
+use Friendica\Util\BasePath;
 use Monolog\Handler\TestHandler;
 
 require_once __DIR__ . '/../../include/api.php';
@@ -34,10 +35,14 @@ class ApiTest extends DatabaseTest
         */
        public function setUp()
        {
-               parent::setUp();
+               $basedir = BasePath::create(dirname(__DIR__) . '/../');
+               $configLoader = new Config\ConfigCacheLoader($basedir);
+               $config = Factory\ConfigFactory::createCache($configLoader);
+               $logger = Factory\LoggerFactory::create('test', $config);
+               $this->app = new App($config, $logger, false);
+               $this->logOutput = FActory\LoggerFactory::enableTest($this->app->getLogger());
 
-               $this->app = BaseObject::getApp();
-               $this->logOutput = LoggerFactory::enableTest($this->app->getLogger());
+               parent::setUp();
 
                // User data that the test database is populated with
                $this->selfUser = [
index 17ac55fd7a5bd58d031b5fdf609c09647c018aec..f2a5cc5558f7dcd853a377d2065f905fbe245331 100644 (file)
@@ -1,19 +1,25 @@
 <?php
 namespace Friendica\Test\Database;
 
-use Friendica\BaseObject;
+use Friendica\App;
 use Friendica\Core\Config;
 use Friendica\Database\DBA;
+use Friendica\Factory;
 use Friendica\Test\DatabaseTest;
+use Friendica\Util\BasePath;
 
 class DBATest extends DatabaseTest
 {
        public function setUp()
        {
-               parent::setUp();
+               $basedir = BasePath::create(dirname(__DIR__) . '/../../');
+               $configLoader = new Config\ConfigCacheLoader($basedir);
+               $config = Factory\ConfigFactory::createCache($configLoader);
+               $logger = Factory\LoggerFactory::create('test', $config);
+               $this->app = new App($config, $logger, false);
+               $this->logOutput = FActory\LoggerFactory::enableTest($this->app->getLogger());
 
-               // Reusable App object
-               $this->app = BaseObject::getApp();
+               parent::setUp();
 
                // Default config
                Config::set('config', 'hostname', 'localhost');
index 268bf8eeddcb08694b4ac18a40521982969ab232..53c4e8895b2dac1afe52cea59b6d5ffa29af7f49 100644 (file)
@@ -2,19 +2,25 @@
 
 namespace Friendica\Test\Database;
 
-use Friendica\BaseObject;
+use Friendica\App;
 use Friendica\Core\Config;
 use Friendica\Database\DBStructure;
+use Friendica\Factory;
 use Friendica\Test\DatabaseTest;
+use Friendica\Util\BasePath;
 
 class DBStructureTest extends DatabaseTest
 {
        public function setUp()
        {
-               parent::setUp();
+               $basedir = BasePath::create(dirname(__DIR__) . '/../../');
+               $configLoader = new Config\ConfigCacheLoader($basedir);
+               $config = Factory\ConfigFactory::createCache($configLoader);
+               $logger = Factory\LoggerFactory::create('test', $config);
+               $this->app = new App($config, $logger, false);
+               $this->logOutput = FActory\LoggerFactory::enableTest($this->app->getLogger());
 
-               // Reusable App object
-               $this->app = BaseObject::getApp();
+               parent::setUp();
 
                // Default config
                Config::set('config', 'hostname', 'localhost');