Skip to content

Commit

Permalink
CC-32421: Added config to disable mocking. (#10908)
Browse files Browse the repository at this point in the history
Enable Cypress CI.
  • Loading branch information
dmiseev authored Apr 1, 2024
1 parent e51c942 commit 70cada4
Showing 1 changed file with 19 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
use SprykerTest\Shared\Testify\Helper\DataCleanupHelperTrait;
use SprykerTest\Shared\Testify\Helper\DependencyHelperTrait;
use SprykerTest\Shared\Testify\Helper\LocatorHelperTrait;
use SprykerTest\Shared\Testify\Helper\ModuleHelperConfigTrait;
use SprykerTest\Zed\Testify\Helper\Business\BusinessHelper;

class CustomerDataHelper extends Module
Expand All @@ -33,12 +34,18 @@ class CustomerDataHelper extends Module
use DataCleanupHelperTrait;
use ConfigHelperTrait;
use ContainerHelperTrait;
use ModuleHelperConfigTrait;

/**
* @var string
*/
protected const SERVICE_STORE = 'store';

/**
* @var string
*/
protected const CONFIG_KEY_IS_MAIL_FACADE_MOCK_ENABLED = 'isMailFacadeMockEnabled';

/**
* @param array $override
*
Expand Down Expand Up @@ -141,8 +148,10 @@ protected function ensureCustomerWithReferenceDoesNotExist(CustomerTransfer $cus
*/
public function getCustomerFacade(): CustomerFacadeInterface
{
$customerToMailBridge = new CustomerToMailBridge($this->getMailFacadeMock());
$this->getDependencyHelper()->setDependency(CustomerDependencyProvider::FACADE_MAIL, $customerToMailBridge);
if ($this->config[static::CONFIG_KEY_IS_MAIL_FACADE_MOCK_ENABLED]) {
$customerToMailBridge = new CustomerToMailBridge($this->getMailFacadeMock());
$this->getDependencyHelper()->setDependency(CustomerDependencyProvider::FACADE_MAIL, $customerToMailBridge);
}

if ($this->isDefaultCustomerFacadeSufficient()) {
return $this->getLocatorHelper()->getLocator()->customer()->facade();
Expand Down Expand Up @@ -197,4 +206,12 @@ protected function getMailFacadeMock(): MailFacadeInterface

return $mailFacadeMock;
}

/**
* @return void
*/
protected function setDefaultConfig(): void
{
$this->config = [static::CONFIG_KEY_IS_MAIL_FACADE_MOCK_ENABLED => true];
}
}

0 comments on commit 70cada4

Please sign in to comment.