diff --git a/tests/Integration/Internal/Framework/Event/EventLoggingSubscriberTest.php b/tests/Integration/Internal/Framework/Event/EventLoggingSubscriberTest.php index 3907a1bc23..4cafb9c62e 100644 --- a/tests/Integration/Internal/Framework/Event/EventLoggingSubscriberTest.php +++ b/tests/Integration/Internal/Framework/Event/EventLoggingSubscriberTest.php @@ -12,7 +12,6 @@ use OxidEsales\EshopCommunity\Internal\Framework\DIContainer\ContainerBuilder; use OxidEsales\EshopCommunity\Internal\Framework\Module\Setup\Event\ServicesYamlConfigurationErrorEvent; use OxidEsales\EshopCommunity\Internal\Transition\Utility\ContextInterface; -use OxidEsales\EshopCommunity\Tests\Unit\Internal\BasicContextStub; use OxidEsales\EshopCommunity\Tests\Unit\Internal\ContextStub; use PHPUnit\Framework\TestCase; use Symfony\Component\EventDispatcher\EventDispatcherInterface; @@ -27,8 +26,10 @@ class EventLoggingSubscriberTest extends TestCase public function setup(): void { parent::setUp(); - $containerBuilder = new ContainerBuilder(new BasicContextStub()); + + $containerBuilder = new ContainerBuilder(new ContextStub()); $this->container = $containerBuilder->getContainer(); + $contextDefinition = $this->container->getDefinition(ContextInterface::class); $contextDefinition->setClass(ContextStub::class); $this->container->compile(); diff --git a/tests/Integration/Internal/Framework/Module/Setup/Validator/ServicesYamlValidatorTest.php b/tests/Integration/Internal/Framework/Module/Setup/Validator/ServicesYamlValidatorTest.php index 77fbbeedb7..a931a0f445 100644 --- a/tests/Integration/Internal/Framework/Module/Setup/Validator/ServicesYamlValidatorTest.php +++ b/tests/Integration/Internal/Framework/Module/Setup/Validator/ServicesYamlValidatorTest.php @@ -15,7 +15,7 @@ use OxidEsales\EshopCommunity\Internal\Framework\Module\Setup\Exception\InvalidModuleServicesException; use OxidEsales\EshopCommunity\Internal\Framework\Module\Setup\Validator\ModuleConfigurationValidatorInterface; use OxidEsales\EshopCommunity\Internal\Framework\Module\Setup\Validator\ServicesYamlValidator; -use OxidEsales\EshopCommunity\Tests\Unit\Internal\BasicContextStub; +use OxidEsales\EshopCommunity\Tests\Unit\Internal\ContextStub; use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Component\Filesystem\Filesystem; @@ -32,7 +32,7 @@ public function setUp(): void { parent::setUp(); - $context = new BasicContextStub(); + $context = new ContextStub(); $this->modulePathResolver = $this->getMockBuilder(ModulePathResolverInterface::class)->getMock(); $this->moduleConfiguration = new ModuleConfiguration(); $this->validator = new ServicesYamlValidator( diff --git a/tests/Unit/Internal/BasicContextStub.php b/tests/Unit/Internal/BasicContextStub.php index 9e3db9b641..73cf7a5691 100644 --- a/tests/Unit/Internal/BasicContextStub.php +++ b/tests/Unit/Internal/BasicContextStub.php @@ -25,7 +25,6 @@ class BasicContextStub implements BasicContextInterface private string $enterpriseEditionRootPath; private string $generatedServicesFilePath; private string $configurableServicesFilePath; - private string $shopConfigurableServicesFilePath; private string $professionalEditionRootPath; private string $sourcePath; private string $shopRootPath; @@ -39,8 +38,9 @@ class BasicContextStub implements BasicContextInterface private string $cacheDirectory; private string $moduleCacheDirectory; private string $templateCacheDirectory; - private int $currentShopId; - private string $activeModuleServicesFilePath; + + protected string $activeModuleServicesFilePath; + protected string $shopConfigurableServicesFilePath; public function __construct() { @@ -65,10 +65,9 @@ public function __construct() $this->cacheDirectory = $basicContext->getCacheDirectory(); $this->moduleCacheDirectory = $basicContext->getModuleCacheDirectory(); $this->templateCacheDirectory = $basicContext->getTemplateCacheDirectory(); - $this->currentShopId = $basicContext->getCurrentShopId(); - $this->activeModuleServicesFilePath = $basicContext->getActiveModuleServicesFilePath($this->getCurrentShopId()); + $this->activeModuleServicesFilePath = $basicContext->getActiveModuleServicesFilePath($this->getDefaultShopId()); $this->shopConfigurableServicesFilePath = $basicContext->getShopConfigurableServicesFilePath( - $this->getCurrentShopId() + $this->getDefaultShopId() ); } @@ -256,14 +255,4 @@ public function setActiveModuleServicesFilePath(string $path): void { $this->activeModuleServicesFilePath = $path; } - - public function getCurrentShopId(): int - { - return $this->currentShopId; - } - - public function setCurrentShopId(int $shopId): void - { - $this->currentShopId = $shopId; - } } diff --git a/tests/Unit/Internal/ContextStub.php b/tests/Unit/Internal/ContextStub.php index 7e12566106..fafdd8c3ea 100644 --- a/tests/Unit/Internal/ContextStub.php +++ b/tests/Unit/Internal/ContextStub.php @@ -25,6 +25,7 @@ class ContextStub extends BasicContextStub implements ContextInterface private $adminUserId; private bool $productiveMode; private $demoMode; + private int $currentShopId; public function __construct() { @@ -39,6 +40,12 @@ public function __construct() $this->skipLogTags = $context->getSkipLogTags(); $this->demoMode = $context->isShopInDemoMode(); $this->productiveMode = $context->isShopInProductiveMode(); + $this->currentShopId = $context->getCurrentShopId(); + + $this->activeModuleServicesFilePath = $context->getActiveModuleServicesFilePath($this->getCurrentShopId()); + $this->shopConfigurableServicesFilePath = $context->getShopConfigurableServicesFilePath( + $this->getCurrentShopId() + ); } /** @@ -213,4 +220,15 @@ public function setShopInDemoMode(bool $demoMode) { $this->demoMode = $demoMode; } + + public function getCurrentShopId(): int + { + return $this->currentShopId; + } + + public function setCurrentShopId(int $shopId): void + { + $this->currentShopId = $shopId; + } + }