Skip to content

Commit

Permalink
TE-10886 Dynamic store. (#9457)
Browse files Browse the repository at this point in the history
TE-10886 Release Dynamic Store
  • Loading branch information
demkos authored Mar 31, 2023
1 parent fee6d04 commit 82c63d6
Show file tree
Hide file tree
Showing 6 changed files with 97 additions and 0 deletions.
3 changes: 3 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,11 @@
},
"require-dev": {
"spryker/code-sniffer": "*",
"spryker/container": "*",
"spryker/propel": "*",
"spryker/queue": "*",
"spryker/store": "*",
"spryker/store-extension": "*",
"spryker/testify": "*"
},
"suggest": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,16 @@ class CustomerStorageClientTest extends Unit
*/
protected CustomerStorageClientTester $tester;

/**
* @return void
*/
protected function setUp(): void
{
parent::setUp();

$this->tester->addDependencies();
}

/**
* @return void
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,13 @@
namespace SprykerTest\Client\CustomerStorage;

use Codeception\Actor;
use Codeception\Stub;
use Generated\Shared\Transfer\InvalidatedCustomerConditionsTransfer;
use Generated\Shared\Transfer\InvalidatedCustomerCriteriaTransfer;
use Generated\Shared\Transfer\StoreTransfer;
use Spryker\Client\CustomerStorage\CustomerStorageClientInterface;
use Spryker\Client\Store\StoreDependencyProvider;
use Spryker\Client\StoreExtension\Dependency\Plugin\StoreExpanderPluginInterface;

/**
* Inherited Methods
Expand All @@ -33,6 +37,16 @@ class CustomerStorageClientTester extends Actor
{
use _generated\CustomerStorageClientTesterActions;

/**
* @var string
*/
protected const DEFAULT_STORE = 'DE';

/**
* @var string
*/
protected const DEFAULT_CURRENCY = 'EUR';

/**
* @var string
*/
Expand All @@ -43,6 +57,16 @@ class CustomerStorageClientTester extends Actor
*/
protected const CUSTOMER_REFERENCE_2 = 'TEST--2';

/**
* @return void
*/
public function addDependencies(): void
{
$this->setDependency(StoreDependencyProvider::PLUGINS_STORE_EXPANDER, [
$this->createStoreStorageStoreExpanderPluginMock(),
]);
}

/**
* @return \Spryker\Client\CustomerStorage\CustomerStorageClientInterface
*/
Expand All @@ -65,4 +89,20 @@ public function createInvalidatedCustomerCriteriaTransfer(): InvalidatedCustomer
return (new InvalidatedCustomerCriteriaTransfer())
->setInvalidatedCustomerConditions($invalidatedCustomerConditionsTransfer);
}

/**
* @return \Spryker\Client\StoreExtension\Dependency\Plugin\StoreExpanderPluginInterface
*/
protected function createStoreStorageStoreExpanderPluginMock(): StoreExpanderPluginInterface
{
$storeTransfer = (new StoreTransfer())
->setName(static::DEFAULT_STORE)
->setDefaultCurrencyIsoCode(static::DEFAULT_CURRENCY);

$storeStorageStoreExpanderPluginMock = Stub::makeEmpty(StoreExpanderPluginInterface::class, [
'expand' => $storeTransfer,
]);

return $storeStorageStoreExpanderPluginMock;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ public function setUp(): void
$container->getLocator()->rabbitMq()->client()->createQueueAdapter(),
];
});

$this->tester->addDependencies();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,16 @@
namespace SprykerTest\Zed\CustomerStorage;

use Codeception\Actor;
use Codeception\Stub;
use DateTime;
use Generated\Shared\Transfer\CustomerTransfer;
use Generated\Shared\Transfer\EventEntityTransfer;
use Generated\Shared\Transfer\InvalidatedCustomerTransfer;
use Generated\Shared\Transfer\PaginationTransfer;
use Generated\Shared\Transfer\StoreTransfer;
use Orm\Zed\CustomerStorage\Persistence\SpyCustomerInvalidatedStorageQuery;
use Spryker\Client\Store\StoreDependencyProvider;
use Spryker\Client\StoreExtension\Dependency\Plugin\StoreExpanderPluginInterface;
use Spryker\Zed\CustomerStorage\CustomerStorageConfig;

/**
Expand Down Expand Up @@ -44,6 +48,26 @@ class CustomerStorageBusinessTester extends Actor
*/
protected const COL_PASSWORD = 'spy_customer.password';

/**
* @var string
*/
protected const DEFAULT_STORE = 'DE';

/**
* @var string
*/
protected const DEFAULT_CURRENCY = 'EUR';

/**
* @return void
*/
public function addDependencies(): void
{
$this->setDependency(StoreDependencyProvider::PLUGINS_STORE_EXPANDER, [
$this->createStoreStorageStoreExpanderPluginMock(),
]);
}

/**
* @param \Generated\Shared\Transfer\CustomerTransfer $customerTransfer
*
Expand Down Expand Up @@ -109,4 +133,20 @@ public function createPaginationTransfer(): PaginationTransfer
->setOffset(0)
->setLimit(10);
}

/**
* @return \Spryker\Client\StoreExtension\Dependency\Plugin\StoreExpanderPluginInterface
*/
protected function createStoreStorageStoreExpanderPluginMock(): StoreExpanderPluginInterface
{
$storeTransfer = (new StoreTransfer())
->setName(static::DEFAULT_STORE)
->setDefaultCurrencyIsoCode(static::DEFAULT_CURRENCY);

$storeStorageStoreExpanderPluginMock = Stub::makeEmpty(StoreExpanderPluginInterface::class, [
'expand' => $storeTransfer,
]);

return $storeStorageStoreExpanderPluginMock;
}
}
2 changes: 2 additions & 0 deletions tests/SprykerTest/Zed/CustomerStorage/codeception.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,5 @@ suites:
- \SprykerTest\Shared\Testify\Helper\DataCleanupHelper
- \SprykerTest\Shared\Propel\Helper\TransactionHelper
- \SprykerTest\Shared\Customer\Helper\CustomerDataHelper
- \SprykerTest\Service\Container\Helper\ContainerHelper
- \SprykerTest\Shared\Store\Helper\StoreDependencyHelper

0 comments on commit 82c63d6

Please sign in to comment.