X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=tests%2Fsrc%2FCore%2FConsole%2FConfigConsoleTest.php;h=c8deda55557e9da8a4962119bfbc62beb26099aa;hb=c150cf4e584101bd894d06b9bf4b3a2c2245e5bf;hp=505c4f794dc58db64f1299d673798e2cb7c14a70;hpb=cb791024e4dee6404567b025348fc08d852a9a0d;p=friendica.git diff --git a/tests/src/Core/Console/ConfigConsoleTest.php b/tests/src/Core/Console/ConfigConsoleTest.php index 505c4f794d..c8deda5555 100644 --- a/tests/src/Core/Console/ConfigConsoleTest.php +++ b/tests/src/Core/Console/ConfigConsoleTest.php @@ -2,6 +2,7 @@ namespace Friendica\Test\src\Core\Console; +use Friendica\App\Mode; use Friendica\Core\Console\Config; /** @@ -15,13 +16,15 @@ class ConfigConsoleTest extends ConsoleTest { parent::setUp(); + $this->mockApp($this->root); + \Mockery::getConfiguration()->setConstantsMap([ - 'Friendica\App\Mode' => [ + Mode::class => [ 'DBCONFIGAVAILABLE' => 0 ] ]); - $mode = \Mockery::mock('Friendica\App\Mode'); + $mode = \Mockery::mock(Mode::class); $mode ->shouldReceive('has') ->andReturn(true); @@ -32,14 +35,14 @@ class ConfigConsoleTest extends ConsoleTest } function testSetGetKeyValue() { - $this->configCache + $this->configMock ->shouldReceive('set') ->with('config', 'test', 'now') ->andReturn(true) ->once(); - $this->configCache + $this->configMock ->shouldReceive('get') - ->with('config', 'test', NULL) + ->with('config', 'test') ->andReturn('now') ->twice(); @@ -50,9 +53,9 @@ class ConfigConsoleTest extends ConsoleTest $txt = $this->dumpExecute($console); $this->assertEquals("config.test <= now\n", $txt); - $this->configCache + $this->configMock ->shouldReceive('get') - ->with('config', 'test', null) + ->with('config', 'test') ->andReturn('now') ->once(); @@ -62,9 +65,9 @@ class ConfigConsoleTest extends ConsoleTest $txt = $this->dumpExecute($console); $this->assertEquals("config.test => now\n", $txt); - $this->configCache + $this->configMock ->shouldReceive('get') - ->with('config', 'test', null) + ->with('config', 'test') ->andReturn(null) ->once(); @@ -77,9 +80,9 @@ class ConfigConsoleTest extends ConsoleTest function testSetArrayValue() { $testArray = [1, 2, 3]; - $this->configCache + $this->configMock ->shouldReceive('get') - ->with('config', 'test', null) + ->with('config', 'test') ->andReturn($testArray) ->once(); @@ -105,9 +108,9 @@ class ConfigConsoleTest extends ConsoleTest } function testVerbose() { - $this->configCache + $this->configMock ->shouldReceive('get') - ->with('test', 'it', null) + ->with('test', 'it') ->andReturn('now') ->once(); $console = new Config($this->consoleArgv); @@ -133,14 +136,14 @@ CONF; } function testUnableToSet() { - $this->configCache + $this->configMock ->shouldReceive('set') ->with('test', 'it', 'now') ->andReturn(false) ->once(); - $this->configCache + $this->configMock ->shouldReceive('get') - ->with('test', 'it', NULL) + ->with('test', 'it') ->andReturn(NULL) ->once(); $console = new Config();