]> git.mxchange.org Git - friendica.git/blobdiff - tests/include/ApiTest.php
BugFix: forgot configCache in ConfigFactory
[friendica.git] / tests / include / ApiTest.php
index ecfe3e962153756ec9c70c30e3a972e699ffe8b8..94557ac69c234b46b78a1bb48f8608d9c94632f1 100644 (file)
@@ -13,6 +13,7 @@ use Friendica\Core\System;
 use Friendica\Factory;
 use Friendica\Network\HTTPException;
 use Friendica\Util\BasePath;
+use Friendica\Util\BaseURL;
 use Friendica\Util\Config\ConfigFileLoader;
 use Monolog\Handler\TestHandler;
 
@@ -54,11 +55,12 @@ class ApiTest extends DatabaseTest
                $configLoader = new ConfigFileLoader($basePath, $mode);
                $configCache = Factory\ConfigFactory::createCache($configLoader);
                $profiler = Factory\ProfilerFactory::create($configCache);
-               Factory\DBFactory::init($basePath, $configCache, $profiler, $_SERVER);
+               $database = Factory\DBFactory::init($configCache, $profiler, $_SERVER);
                $config = Factory\ConfigFactory::createConfig($configCache);
-               Factory\ConfigFactory::createPConfig($configCache);
-               $logger = Factory\LoggerFactory::create('test', $config, $profiler);
-               $this->app = new App($config, $mode, $router, $logger, $profiler, false);
+               Factory\ConfigFactory::createPConfig($configCache, new Config\Cache\PConfigCache());
+               $logger = Factory\LoggerFactory::create('test', $database, $config, $profiler);
+               $baseUrl = new BaseURL($config, $_SERVER);
+               $this->app = new App($database, $config, $mode, $router, $baseUrl, $logger, $profiler, false);
 
                parent::setUp();
 
@@ -608,8 +610,8 @@ class ApiTest extends DatabaseTest
        public function testApiErrorWithJson()
        {
                $this->assertEquals(
-                       '{"status":{"error":"error_message","code":"200 Friendica\\\\Network\\\\HTTP","request":""}}',
-                       api_error('json', new HTTPException('error_message'))
+                       '{"status":{"error":"error_message","code":"200 OK","request":""}}',
+                       api_error('json', new HTTPException\OKException('error_message'))
                );
        }
 
@@ -626,10 +628,10 @@ class ApiTest extends DatabaseTest
                                'xmlns:friendica="http://friendi.ca/schema/api/1/" '.
                                'xmlns:georss="http://www.georss.org/georss">'."\n".
                        '  <error>error_message</error>'."\n".
-                       '  <code>200 Friendica\Network\HTTP</code>'."\n".
+                       '  <code>200 OK</code>'."\n".
                        '  <request/>'."\n".
                        '</status>'."\n",
-                       api_error('xml', new HTTPException('error_message'))
+                       api_error('xml', new HTTPException\OKException('error_message'))
                );
        }
 
@@ -646,10 +648,10 @@ class ApiTest extends DatabaseTest
                                'xmlns:friendica="http://friendi.ca/schema/api/1/" '.
                                'xmlns:georss="http://www.georss.org/georss">'."\n".
                        '  <error>error_message</error>'."\n".
-                       '  <code>200 Friendica\Network\HTTP</code>'."\n".
+                       '  <code>200 OK</code>'."\n".
                        '  <request/>'."\n".
                        '</status>'."\n",
-                       api_error('rss', new HTTPException('error_message'))
+                       api_error('rss', new HTTPException\OKException('error_message'))
                );
        }
 
@@ -666,10 +668,10 @@ class ApiTest extends DatabaseTest
                                'xmlns:friendica="http://friendi.ca/schema/api/1/" '.
                                'xmlns:georss="http://www.georss.org/georss">'."\n".
                        '  <error>error_message</error>'."\n".
-                       '  <code>200 Friendica\Network\HTTP</code>'."\n".
+                       '  <code>200 OK</code>'."\n".
                        '  <request/>'."\n".
                        '</status>'."\n",
-                       api_error('atom', new HTTPException('error_message'))
+                       api_error('atom', new HTTPException\OKException('error_message'))
                );
        }