Replace Config-Cache dependency with Config-Model (no more DB-waiting necessary)
This commit is contained in:
@@ -24,7 +24,7 @@ namespace Friendica\Test\src\App;
|
||||
use Detection\MobileDetect;
|
||||
use Friendica\App\Arguments;
|
||||
use Friendica\App\Mode;
|
||||
use Friendica\Core\Config\ValueObject\Cache;
|
||||
use Friendica\Core\Config\Capability\IManageConfigValues;
|
||||
use Friendica\Database\Database;
|
||||
use Friendica\Test\MockedTest;
|
||||
use Friendica\Test\Util\VFSTrait;
|
||||
@@ -47,9 +47,9 @@ class ModeTest extends MockedTest
|
||||
private $databaseMock;
|
||||
|
||||
/**
|
||||
* @var Cache|MockInterface
|
||||
* @var IManageConfigValues|MockInterface
|
||||
*/
|
||||
private $configCacheMock;
|
||||
private $configMock;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
@@ -57,8 +57,8 @@ class ModeTest extends MockedTest
|
||||
|
||||
$this->setUpVfsDir();
|
||||
|
||||
$this->databaseMock = Mockery::mock(Database::class);
|
||||
$this->configCacheMock = Mockery::mock(Cache::class);
|
||||
$this->databaseMock = Mockery::mock(Database::class);
|
||||
$this->configMock = Mockery::mock(IManageConfigValues::class);
|
||||
}
|
||||
|
||||
public function testItEmpty()
|
||||
@@ -76,7 +76,7 @@ class ModeTest extends MockedTest
|
||||
|
||||
self::assertFalse($this->root->hasChild('config/local.config.php'));
|
||||
|
||||
$mode = (new Mode())->determine($this->root->url(), $this->databaseMock, $this->configCacheMock);
|
||||
$mode = (new Mode())->determine($this->root->url(), $this->databaseMock, $this->configMock);
|
||||
|
||||
self::assertTrue($mode->isInstall());
|
||||
self::assertFalse($mode->isNormal());
|
||||
@@ -88,7 +88,7 @@ class ModeTest extends MockedTest
|
||||
{
|
||||
$this->databaseMock->shouldReceive('connected')->andReturn(false)->once();
|
||||
|
||||
$mode = (new Mode())->determine($this->root->url(), $this->databaseMock, $this->configCacheMock);
|
||||
$mode = (new Mode())->determine($this->root->url(), $this->databaseMock, $this->configMock);
|
||||
|
||||
self::assertFalse($mode->isNormal());
|
||||
self::assertTrue($mode->isInstall());
|
||||
@@ -100,10 +100,10 @@ class ModeTest extends MockedTest
|
||||
public function testWithMaintenanceMode()
|
||||
{
|
||||
$this->databaseMock->shouldReceive('connected')->andReturn(true)->once();
|
||||
$this->configCacheMock->shouldReceive('get')->with('system', 'maintenance')
|
||||
$this->configMock->shouldReceive('get')->with('system', 'maintenance')
|
||||
->andReturn(true)->once();
|
||||
|
||||
$mode = (new Mode())->determine($this->root->url(), $this->databaseMock, $this->configCacheMock);
|
||||
$mode = (new Mode())->determine($this->root->url(), $this->databaseMock, $this->configMock);
|
||||
|
||||
self::assertFalse($mode->isNormal());
|
||||
self::assertFalse($mode->isInstall());
|
||||
@@ -114,10 +114,10 @@ class ModeTest extends MockedTest
|
||||
public function testNormalMode()
|
||||
{
|
||||
$this->databaseMock->shouldReceive('connected')->andReturn(true)->once();
|
||||
$this->configCacheMock->shouldReceive('get')->with('system', 'maintenance')
|
||||
$this->configMock->shouldReceive('get')->with('system', 'maintenance')
|
||||
->andReturn(false)->once();
|
||||
|
||||
$mode = (new Mode())->determine($this->root->url(), $this->databaseMock, $this->configCacheMock);
|
||||
$mode = (new Mode())->determine($this->root->url(), $this->databaseMock, $this->configMock);
|
||||
|
||||
self::assertTrue($mode->isNormal());
|
||||
self::assertFalse($mode->isInstall());
|
||||
@@ -131,10 +131,10 @@ class ModeTest extends MockedTest
|
||||
public function testDisabledMaintenance()
|
||||
{
|
||||
$this->databaseMock->shouldReceive('connected')->andReturn(true)->once();
|
||||
$this->configCacheMock->shouldReceive('get')->with('system', 'maintenance')
|
||||
$this->configMock->shouldReceive('get')->with('system', 'maintenance')
|
||||
->andReturn(false)->once();
|
||||
|
||||
$mode = (new Mode())->determine($this->root->url(), $this->databaseMock, $this->configCacheMock);
|
||||
$mode = (new Mode())->determine($this->root->url(), $this->databaseMock, $this->configMock);
|
||||
|
||||
self::assertTrue($mode->isNormal());
|
||||
self::assertFalse($mode->isInstall());
|
||||
@@ -149,7 +149,7 @@ class ModeTest extends MockedTest
|
||||
{
|
||||
$mode = new Mode();
|
||||
|
||||
$modeNew = $mode->determine('', $this->databaseMock, $this->configCacheMock);
|
||||
$modeNew = $mode->determine('', $this->databaseMock, $this->configMock);
|
||||
|
||||
self::assertNotSame($modeNew, $mode);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user