Skip to content

Commit

Permalink
Merge branch '6.1' into 6.x
Browse files Browse the repository at this point in the history
* 6.1:
  [MultidomainBundle] Fix issues with empty host in multidomain config
  • Loading branch information
acrobat committed Feb 7, 2022
2 parents 1e2c1e5 + 2f6a85c commit 5be6988
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/Kunstmaan/AdminBundle/Helper/DomainConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ public function getHostSwitched()

/**
* @param string|null $host
*
* @return string|null
*/
public function getHostBaseUrl($host = null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,12 +303,16 @@ public function getFullHostById($id)
/**
* @param string|null $host
*
* @return string
* @return string|null
*/
public function getHostBaseUrl($host = null)
{
$config = $this->getFullHost($host);

if (!is_array($config)) {
return null;
}

return sprintf('%s://%s', $config['protocol'], $config['host']);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,18 @@ public function testGetHostBaseUrl()
$this->assertEquals('http://multilangdomain.tld', $object->getHostBaseUrl('multilangdomain.tld'));
}

public function testGetHostBaseUrlWithEmptyRequestUrl()
{
$object = $this->getDomainConfiguration(Request::create(''));
$this->assertNull($object->getHostBaseUrl());
}

public function testGetHostBaseUrlWithUnkownHost()
{
$object = $this->getDomainConfiguration(Request::create('unkowndomain.tld'));
$this->assertNull($object->getHostBaseUrl());
}

public function testGetFullHost()
{
$request = $this->getSingleLanguageRequest();
Expand Down

0 comments on commit 5be6988

Please sign in to comment.