]> git.mxchange.org Git - friendica.git/blobdiff - tests/functional/DependencyCheckTest.php
[frio] Larger clickable area for tabs
[friendica.git] / tests / functional / DependencyCheckTest.php
index a371ffea4ca7c4e881643bcd744a62f040115b1c..27e693295ecd4af55311dfb57d24fb4c92e6d77c 100644 (file)
@@ -32,7 +32,6 @@ use Friendica\Database\Database;
 use Friendica\Test\Util\VFSTrait;
 use Friendica\Util\BasePath;
 use Friendica\Core\Config\Util\ConfigFileManager;
-use Friendica\Util\Profiler;
 use PHPUnit\Framework\TestCase;
 use Psr\Log\LoggerInterface;
 
@@ -52,7 +51,18 @@ class DependencyCheckTest extends TestCase
                $this->setUpVfsDir();
 
                $this->dice = (new Dice())
-                       ->addRules(include __DIR__ . '/../../static/dependencies.config.php');
+                       ->addRules(include __DIR__ . '/../../static/dependencies.config.php')
+                       ->addRule(BasePath::class, [
+                               'constructParams' => [
+                                       $this->root->url(),
+                                       [],
+                               ],
+                       ])
+                       ->addRule(LoggerInterface::class, ['constructParams' => ['test']]);
+
+               /** @var IManageConfigValues $config */
+               $config = $this->dice->create(IManageConfigValues::class);
+               $config->set('system', 'logfile', $this->root->url() . '/logs/friendica.log');
        }
 
        /**
@@ -86,33 +96,6 @@ class DependencyCheckTest extends TestCase
                self::assertArrayHasKey('system', $configCache->getAll());
        }
 
-       /**
-        * Test the construction of a profiler class with DI
-        */
-       public function testProfiler()
-       {
-               /** @var Profiler $profiler */
-               $profiler = $this->dice->create(Profiler::class);
-
-               self::assertInstanceOf(Profiler::class, $profiler);
-
-               $configCache = new Cache([
-                       'system' => [
-                               'profiler' => true,
-                       ],
-                       'rendertime' => [
-                               'callstack' => true,
-                       ]
-               ]);
-
-               // create new DI-library because of shared instance rule (so the Profiler wouldn't get created twice)
-               $this->dice = new Dice();
-               $profiler = $this->dice->create(Profiler::class, [$configCache]);
-
-               self::assertInstanceOf(Profiler::class, $profiler);
-               self::assertTrue($profiler->isRendertime());
-       }
-
        public function testDatabase()
        {
                // PDO needs to be disabled for PHP 7.2, see https://jira.mariadb.org/browse/MDEV-24121
@@ -168,7 +151,7 @@ class DependencyCheckTest extends TestCase
        public function testLogger()
        {
                /** @var LoggerInterface $logger */
-               $logger = $this->dice->create(LoggerInterface::class, ['test']);
+               $logger = $this->dice->create(LoggerInterface::class, [['$channel' => 'test']]);
 
                self::assertInstanceOf(LoggerInterface::class, $logger);
        }
@@ -180,7 +163,7 @@ class DependencyCheckTest extends TestCase
                $config->set('system', 'dlogfile', $this->root->url() . '/friendica.log');
 
                /** @var LoggerInterface $logger */
-               $logger = $this->dice->create('$devLogger', ['dev']);
+               $logger = $this->dice->create('$devLogger', [['$channel' => 'dev']]);
 
                self::assertInstanceOf(LoggerInterface::class, $logger);
        }
@@ -190,6 +173,7 @@ class DependencyCheckTest extends TestCase
                /** @var ICanCache $cache */
                $cache = $this->dice->create(ICanCache::class);
 
+
                self::assertInstanceOf(ICanCache::class, $cache);
        }