// this is in the same namespace as Install for mocking 'function_exists'
namespace Friendica\Core;
+use Friendica\Core\Config\Cache\IConfigCache;
+use Friendica\Network\CurlResult;
+use Friendica\Object\Image;
use Friendica\Test\MockedTest;
use Friendica\Test\Util\L10nMockTrait;
use Friendica\Test\Util\VFSTrait;
+use Friendica\Util\Network;
/**
* @runTestsInSeparateProcesses
$this->mockL10nT();
// Mocking the CURL Response
- $curlResult = \Mockery::mock('Friendica\Network\CurlResult');
+ $curlResult = \Mockery::mock(CurlResult::class);
$curlResult
->shouldReceive('getReturnCode')
->andReturn('404');
->andReturn('test Error');
// Mocking the CURL Request
- $networkMock = \Mockery::mock('alias:Friendica\Util\Network');
+ $networkMock = \Mockery::mock('alias:' . Network::class);
$networkMock
->shouldReceive('fetchUrlFull')
->with('https://test/install/testrewrite')
$this->mockL10nT();
// Mocking the failed CURL Response
- $curlResultF = \Mockery::mock('Friendica\Network\CurlResult');
+ $curlResultF = \Mockery::mock(CurlResult::class);
$curlResultF
->shouldReceive('getReturnCode')
->andReturn('404');
// Mocking the working CURL Response
- $curlResultW = \Mockery::mock('Friendica\Network\CurlResult');
+ $curlResultW = \Mockery::mock(CurlResult::class);
$curlResultW
->shouldReceive('getReturnCode')
->andReturn('204');
// Mocking the CURL Request
- $networkMock = \Mockery::mock('alias:Friendica\Util\Network');
+ $networkMock = \Mockery::mock('alias:' . Network::class);
$networkMock
->shouldReceive('fetchUrlFull')
->with('https://test/install/testrewrite')
{
$this->mockL10nT();
- $imageMock = \Mockery::mock('alias:Friendica\Object\Image');
+ $imageMock = \Mockery::mock('alias:'. Image::class);
$imageMock
->shouldReceive('supportedTypes')
->andReturn(['image/gif' => 'gif']);
{
$this->mockL10nT();
- $imageMock = \Mockery::mock('alias:Friendica\Object\Image');
+ $imageMock = \Mockery::mock('alias:' . Image::class);
$imageMock
->shouldReceive('supportedTypes')
->andReturn([]);
false,
$install->getChecks());
}
+
+ /**
+ * Test the setup of the config cache for installation
+ */
+ public function testSetUpCache()
+ {
+ $this->mockL10nT();
+
+ $install = new Installer();
+ $configCache = \Mockery::mock(IConfigCache::class);
+ $configCache->shouldReceive('set')->with('config', 'php_path', \Mockery::any())->once();
+ $configCache->shouldReceive('set')->with('system', 'basepath', '/test/')->once();
+
+ $install->setUpCache($configCache, '/test/');
+ }
}
/**