]> git.mxchange.org Git - friendica.git/commitdiff
Fix mock test (remove "implicit" usage of previous Dice-setups)
authornupplaPhil <admin@philipp.info>
Sat, 21 Dec 2019 20:15:16 +0000 (21:15 +0100)
committernupplaPhil <admin@philipp.info>
Sun, 29 Dec 2019 19:18:21 +0000 (20:18 +0100)
tests/src/Core/SystemTest.php

index a385d1b35284feee92da2f55dd2b38d5ef05a54d..af8d2f8f736a9460864ba78e2bcc6b4578bf9161 100644 (file)
@@ -2,11 +2,26 @@
 
 namespace Friendica\Test\src\Core;
 
+use Dice\Dice;
+use Friendica\App\BaseURL;
 use Friendica\Core\System;
+use Friendica\DI;
 use PHPUnit\Framework\TestCase;
 
 class SystemTest extends TestCase
 {
+       protected function setUp()
+       {
+               parent::setUp();
+
+               $baseUrl = \Mockery::mock(BaseURL::class);
+               $baseUrl->shouldReceive('getHostname')->andReturn('friendica.local')->once();
+               $dice = \Mockery::mock(Dice::class);
+               $dice->shouldReceive('create')->with(BaseURL::class, [])->andReturn($baseUrl);
+
+               DI::init($dice);
+       }
+
        private function assertGuid($guid, $length, $prefix = '')
        {
                $length -= strlen($prefix);