Commit 9c75b997 authored by Thomas Löffler's avatar Thomas Löffler
Browse files

Fix unit tests

parent 1f5e994f
Pipeline #11350 passed with stages
in 5 minutes and 49 seconds
......@@ -119,13 +119,7 @@ class ExtensionIndexService implements LoggerAwareInterface
$dom = new \DOMDocument('1.0', 'utf-8');
$dom->formatOutput = true;
$extensionsObj = $dom->appendChild(new \DOMElement('extensions'));
$distributionBaseUrl = implode(
'',
[
(string)GeneralUtility::makeInstance(SiteFinder::class)->getSiteByIdentifier('extensions')->getBase() . '/',
ResourceFactory::getInstance()->getDefaultStorage()->getFolder('ter')->getPublicUrl()
]
);
$distributionBaseUrl = $this->getDistributionBaseUrl();
// Create the nested XML structure:
foreach ($extensionsAndVersionsArr as $extensionKey => $extensionVersionsArr) {
......@@ -260,4 +254,15 @@ class ExtensionIndexService implements LoggerAwareInterface
? (string)serialize(json_decode($dependencies, true))
: '';
}
protected function getDistributionBaseUrl(): string
{
return implode(
'',
[
(string)GeneralUtility::makeInstance(SiteFinder::class)->getSiteByIdentifier('extensions')->getBase() . '/',
GeneralUtility::makeInstance(ResourceFactory::class)->getDefaultStorage()->getFolder('ter')->getPublicUrl()
]
);
}
}
......@@ -134,7 +134,18 @@ class ExtensionIndexServiceTest extends UnitTestCase
</extension>
</extensions>
';
$subject = new ExtensionIndexService(Environment::getVarPath() . '/tests-extensions-xml');
$subject = self::getAccessibleMock(
ExtensionIndexService::class,
['getDistributionBaseUrl'],
[Environment::getVarPath() . '/tests-extensions-xml'],
'',
false
);
$subject
->expects(self::once())
->method('getDistributionBaseUrl')
->willReturn('https://ter.local/fileadmin/ter/');
$extensions = [
'acme' => [
'downloads' => 13,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment