namespace Friendica\Test\src\Core\Console;
+use Friendica\App\Mode;
use Friendica\Core\Console\Config;
/**
{
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);
}
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, false)
+ ->with('config', 'test')
->andReturn('now')
->twice();
$txt = $this->dumpExecute($console);
$this->assertEquals("config.test <= now\n", $txt);
- $this->configCache
+ $this->configMock
->shouldReceive('get')
- ->with('config', 'test', null, false)
+ ->with('config', 'test')
->andReturn('now')
->once();
$txt = $this->dumpExecute($console);
$this->assertEquals("config.test => now\n", $txt);
- $this->configCache
+ $this->configMock
->shouldReceive('get')
- ->with('config', 'test', null, false)
+ ->with('config', 'test')
->andReturn(null)
->once();
function testSetArrayValue() {
$testArray = [1, 2, 3];
- $this->configCache
+ $this->configMock
->shouldReceive('get')
- ->with('config', 'test', null, false)
+ ->with('config', 'test')
->andReturn($testArray)
->once();
}
function testVerbose() {
- $this->configCache
+ $this->configMock
->shouldReceive('get')
- ->with('test', 'it', null, false)
+ ->with('test', 'it')
->andReturn('now')
->once();
$console = new Config($this->consoleArgv);
}
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, false)
+ ->with('test', 'it')
->andReturn(NULL)
->once();
$console = new Config();