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 ...@@ -119,13 +119,7 @@ class ExtensionIndexService implements LoggerAwareInterface
$dom = new \DOMDocument('1.0', 'utf-8'); $dom = new \DOMDocument('1.0', 'utf-8');
$dom->formatOutput = true; $dom->formatOutput = true;
$extensionsObj = $dom->appendChild(new \DOMElement('extensions')); $extensionsObj = $dom->appendChild(new \DOMElement('extensions'));
$distributionBaseUrl = implode( $distributionBaseUrl = $this->getDistributionBaseUrl();
'',
[
(string)GeneralUtility::makeInstance(SiteFinder::class)->getSiteByIdentifier('extensions')->getBase() . '/',
ResourceFactory::getInstance()->getDefaultStorage()->getFolder('ter')->getPublicUrl()
]
);
// Create the nested XML structure: // Create the nested XML structure:
foreach ($extensionsAndVersionsArr as $extensionKey => $extensionVersionsArr) { foreach ($extensionsAndVersionsArr as $extensionKey => $extensionVersionsArr) {
...@@ -260,4 +254,15 @@ class ExtensionIndexService implements LoggerAwareInterface ...@@ -260,4 +254,15 @@ class ExtensionIndexService implements LoggerAwareInterface
? (string)serialize(json_decode($dependencies, true)) ? (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 ...@@ -134,7 +134,18 @@ class ExtensionIndexServiceTest extends UnitTestCase
</extension> </extension>
</extensions> </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 = [ $extensions = [
'acme' => [ 'acme' => [
'downloads' => 13, '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