mirror of
https://github.com/friendica/friendica
synced 2025-05-01 17:44:23 +02:00
Remove BaseURL Auto-Check
This commit is contained in:
parent
9ff3aca3b2
commit
3de78fc60b
3 changed files with 5 additions and 143 deletions
|
@ -200,47 +200,6 @@ class BaseURLTest extends MockedTest
|
|||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the default config determination
|
||||
* @dataProvider dataDefault
|
||||
*/
|
||||
public function testCheck($server, $input, $assert)
|
||||
{
|
||||
$configMock = \Mockery::mock(IManageConfigValues::class);
|
||||
$configMock->shouldReceive('get')->with('config', 'hostname')->andReturn($input['hostname']);
|
||||
$configMock->shouldReceive('get')->with('system', 'urlpath')->andReturn($input['urlPath']);
|
||||
$configMock->shouldReceive('get')->with('system', 'ssl_policy')->andReturn($input['sslPolicy']);
|
||||
$configMock->shouldReceive('get')->with('system', 'url')->andReturn($input['url']);
|
||||
|
||||
// If we don't have an urlPath as an input, we assert it, we will save it to the DB for the next time
|
||||
if (!isset($input['urlPath']) && isset($assert['urlPath'])) {
|
||||
$configMock->shouldReceive('set')->with('system', 'urlpath', $assert['urlPath'])->once();
|
||||
}
|
||||
|
||||
// If we don't have the ssl_policy as an input, we assert it, we will save it to the DB for the next time
|
||||
if (!isset($input['sslPolicy']) && isset($assert['sslPolicy'])) {
|
||||
$configMock->shouldReceive('set')->with('system', 'ssl_policy', $assert['sslPolicy'])->once();
|
||||
}
|
||||
|
||||
// If we don't have the hostname as an input, we assert it, we will save it to the DB for the next time
|
||||
if (empty($input['hostname']) && !empty($assert['hostname'])) {
|
||||
$configMock->shouldReceive('set')->with('config', 'hostname', $assert['hostname'])->once();
|
||||
}
|
||||
|
||||
// If we don't have an URL at first, but we assert it, we will save it to the DB for the next time
|
||||
if (empty($input['url']) && !empty($assert['url'])) {
|
||||
$configMock->shouldReceive('set')->with('system', 'url', $assert['url'])->once();
|
||||
}
|
||||
|
||||
$baseUrl = new BaseURL($configMock, $server);
|
||||
|
||||
self::assertEquals($assert['hostname'], $baseUrl->getHostname());
|
||||
self::assertEquals($assert['urlPath'], $baseUrl->getUrlPath());
|
||||
self::assertEquals($assert['sslPolicy'], $baseUrl->getSSLPolicy());
|
||||
self::assertEquals($assert['scheme'], $baseUrl->getScheme());
|
||||
self::assertEquals($assert['url'], $baseUrl->get());
|
||||
}
|
||||
|
||||
public function dataSave()
|
||||
{
|
||||
return [
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue