This commit is contained in:
2026-09-15 10:26:34 +08:00
commit ecf36afa56
10493 changed files with 1404888 additions and 0 deletions
+5
View File
@@ -0,0 +1,5 @@
/*.xml
!/etc/integration-tests-config.xml
/var/
/etc/*.php
/framework/tests/unit/var/allure-results/
@@ -0,0 +1,55 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\TestModuleAsyncAmqp\Model;
class AsyncTestData
{
/**
* @var $msgValue
*/
protected $msgValue;
/**
* @var $path
*/
protected $path;
/**
* set path to tmp directory.
*
* @param string $path
* @return void
*/
public function setTextFilePath($path)
{
$this->path = $path;
}
/**
* @return string
*/
public function getTextFilePath()
{
return $this->path;
}
/**
* @param string $strValue
* @return void
*/
public function setValue($strValue)
{
$this->msgValue = $strValue;
}
/**
* @return string
*/
public function getValue()
{
return $this->msgValue;
}
}
@@ -0,0 +1,59 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\TestModuleAsyncAmqp\Model;
class CustomHandler
{
/**
* @param AsyncTestData $simpleDataItem
*/
public function process($simpleDataItem)
{
file_put_contents(
$simpleDataItem->getTextFilePath(),
'custom-string-' . $simpleDataItem->getValue() . PHP_EOL,
FILE_APPEND
);
}
/**
* @param AsyncTestData[] $simpleDataItems
*/
public function processArray($simpleDataItems)
{
foreach ($simpleDataItems as $objItem) {
file_put_contents(
$objItem->getTextFilePath(),
'custom-array-' . $objItem->getValue() . PHP_EOL,
FILE_APPEND
);
}
}
/**
* @param mixed $simpleDataItems
*/
public function processMixed($simpleDataItems)
{
/** @var AsyncTestData[] $simpleDataItems */
$simpleDataItems = is_array($simpleDataItems) ? $simpleDataItems : [$simpleDataItems];
foreach ($simpleDataItems as $simpleDataItem) {
if (!($simpleDataItem instanceof AsyncTestData)) {
file_put_contents(
$simpleDataItem->getTextFilePath(),
'Invalid data item given. Was expected instance of ' . AsyncTestData::class . PHP_EOL,
FILE_APPEND
);
continue;
}
file_put_contents(
$simpleDataItem->getTextFilePath(),
'custom-mixed-' . $simpleDataItem->getValue() . PHP_EOL,
FILE_APPEND
);
}
}
}
@@ -0,0 +1,21 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\TestModuleAsyncAmqp\Model;
class RequestHandler
{
/**
* @param \Magento\TestModuleAsyncAmqp\Model\AsyncTestData $simpleDataItem
*/
public function process($simpleDataItem)
{
file_put_contents(
$simpleDataItem->getTextFilePath(),
'InvokedFromRequestHandler-' . $simpleDataItem->getValue() . PHP_EOL,
FILE_APPEND
);
}
}
@@ -0,0 +1,57 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\TestModuleAsyncAmqp\Model;
class WildCardHandler
{
/**
* @param AsyncTestData $simpleDataItem
*/
public function methodOne(AsyncTestData $simpleDataItem)
{
file_put_contents(
$simpleDataItem->getTextFilePath(),
'WildCardHandler::methodOne - wildcard.queue.one - ' . $simpleDataItem->getValue() . PHP_EOL,
FILE_APPEND
);
}
/**
* @param AsyncTestData $simpleDataItem
*/
public function methodTwo(AsyncTestData $simpleDataItem)
{
file_put_contents(
$simpleDataItem->getTextFilePath(),
'WildCardHandler::methodTwo - wildcard.queue.two - ' . $simpleDataItem->getValue() . PHP_EOL,
FILE_APPEND
);
}
/**
* @param AsyncTestData $simpleDataItem
*/
public function methodThree(AsyncTestData $simpleDataItem)
{
file_put_contents(
$simpleDataItem->getTextFilePath(),
'WildCardHandler::methodThree - wildcard.queue.three - ' . $simpleDataItem->getValue() . PHP_EOL,
FILE_APPEND
);
}
/**
* @param AsyncTestData $simpleDataItem
*/
public function methodFour(AsyncTestData $simpleDataItem)
{
file_put_contents(
$simpleDataItem->getTextFilePath(),
'WildCardHandler::methodFour - wildcard.queue.four - ' . $simpleDataItem->getValue() . PHP_EOL,
FILE_APPEND
);
}
}
@@ -0,0 +1,37 @@
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Communication/etc/communication.xsd">
<topic name="multi.topic.queue.topic.c.deprecated" request="Magento\TestModuleAsyncAmqp\Model\AsyncTestData">
<handler name="processAsyncReqC" type="Magento\TestModuleAsyncAmqp\Model\RequestHandler" method="process"/>
</topic>
<topic name="multi.topic.queue.topic.d.deprecated" request="Magento\TestModuleAsyncAmqp\Model\AsyncTestData">
<handler name="processAsyncReqD" type="Magento\TestModuleAsyncAmqp\Model\RequestHandler" method="process"/>
</topic>
<topic name="multi.topic.queue.topic.c" request="Magento\TestModuleAsyncAmqp\Model\AsyncTestData">
<handler name="processAsyncReqC" type="Magento\TestModuleAsyncAmqp\Model\RequestHandler" method="process"/>
</topic>
<topic name="multi.topic.queue.topic.d" request="Magento\TestModuleAsyncAmqp\Model\AsyncTestData">
<handler name="processAsyncReqD" type="Magento\TestModuleAsyncAmqp\Model\RequestHandler" method="process"/>
</topic>
<topic name="multi.topic.queue.topic.y" request="Magento\TestModuleAsyncAmqp\Model\AsyncTestData">
<handler name="processAsyncReqC" type="Magento\TestModuleAsyncAmqp\Model\RequestHandler" method="process"/>
</topic>
<topic name="multi.topic.queue.topic.z" request="Magento\TestModuleAsyncAmqp\Model\AsyncTestData">
<handler name="processAsyncReqD" type="Magento\TestModuleAsyncAmqp\Model\RequestHandler" method="process"/>
</topic>
<topic name="mtmh.topic.1" request="Magento\TestModuleAsyncAmqp\Model\AsyncTestData">
<handler name="mtmh.handler.1" type="Magento\TestModuleAsyncAmqp\Model\CustomHandler" method="process"/>
</topic>
<topic name="mtmh.topic.2" request="Magento\TestModuleAsyncAmqp\Model\AsyncTestData[]">
<handler name="mtmh.handler.2" type="Magento\TestModuleAsyncAmqp\Model\CustomHandler" method="processArray"/>
</topic>
<topic name="segment1.segment2.segment3.wildcard" request="Magento\TestModuleAsyncAmqp\Model\AsyncTestData"/>
<topic name="segment2.segment3.wildcard" request="Magento\TestModuleAsyncAmqp\Model\AsyncTestData"/>
<topic name="not.matching.wildcard.topic" request="Magento\TestModuleAsyncAmqp\Model\AsyncTestData"/>
</config>
@@ -0,0 +1,10 @@
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Magento_TestModuleAsyncAmqp" />
</config>
@@ -0,0 +1,21 @@
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework-message-queue:etc/queue.xsd">
<broker topic="multi.topic.queue.topic.c.deprecated" type="amqp" exchange="magento">
<queue consumer="queue.for.multiple.topics.test.c.deprecated" name="queue.for.multiple.topics.test.c.deprecated"/>
<queue consumer="mixed.sync.and.async.queue.consumer.deprecated" name="mixed.sync.and.async.queue.deprecated"/>
</broker>
<broker topic="multi.topic.queue.topic.d.deprecated" type="amqp" exchange="magento">
<queue consumer="queue.for.multiple.topics.test.d.deprecated" name="queue.for.multiple.topics.test.d.deprecated"/>
</broker>
</config>
@@ -0,0 +1,20 @@
<!--<?xml version="1.0"?>-->
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework-message-queue:etc/consumer.xsd">
<consumer name="queue.for.multiple.topics.test.c" queue="queue.for.multiple.topics.test.c"/>
<consumer name="queue.for.multiple.topics.test.d" queue="queue.for.multiple.topics.test.d"/>
<consumer name="queue.for.multiple.topics.test.y" queue="queue.for.multiple.topics.test.y" connection="amqp"/>
<consumer name="queue.for.multiple.topics.test.z" queue="queue.for.multiple.topics.test.z" connection="amqp"/>
<consumer name="mixed.sync.and.async.queue.consumer" connection="amqp" queue="mixed.sync.and.async.queue"/>
<consumer name="mtmh.queue.1.consumer" queue="mtmh.queue.1" connection="amqp" handler="Magento\TestModuleAsyncAmqp\Model\CustomHandler::processMixed"/>
<consumer name="mtmh.queue.2.consumer" queue="mtmh.queue.2" connection="amqp"/>
<consumer name="wildcard.queue.one.consumer" connection="amqp" queue="wildcard.queue.one" handler="Magento\TestModuleAsyncAmqp\Model\WildCardHandler::methodOne"/>
<consumer name="wildcard.queue.two.consumer" connection="amqp" queue="wildcard.queue.two" handler="Magento\TestModuleAsyncAmqp\Model\WildCardHandler::methodTwo"/>
<consumer name="wildcard.queue.three.consumer" connection="amqp" queue="wildcard.queue.three" handler="Magento\TestModuleAsyncAmqp\Model\WildCardHandler::methodThree"/>
<consumer name="wildcard.queue.four.consumer" connection="amqp" queue="wildcard.queue.four" handler="Magento\TestModuleAsyncAmqp\Model\WildCardHandler::methodFour"/>
</config>
@@ -0,0 +1,36 @@
<!--<?xml version="1.0"?>-->
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework-message-queue:etc/publisher.xsd">
<publisher topic="multi.topic.queue.topic.c">
<connection name="amqp" exchange="magento" />
</publisher>
<publisher topic="multi.topic.queue.topic.d">
<connection name="amqp" exchange="magento" />
</publisher>
<publisher topic="multi.topic.queue.topic.y">
<connection name="amqp" exchange="magento" />
</publisher>
<publisher topic="multi.topic.queue.topic.z">
<connection name="amqp" exchange="magento" />
</publisher>
<publisher topic="mtmh.topic.1">
<connection name="amqp" exchange="magento" />
</publisher>
<publisher topic="mtmh.topic.2">
<connection name="amqp" exchange="magento" />
</publisher>
<publisher topic="segment1.segment2.segment3.wildcard">
<connection name="amqp" exchange="magento" />
</publisher>
<publisher topic="segment2.segment3.wildcard">
<connection name="amqp" exchange="magento" />
</publisher>
<publisher topic="not.matching.wildcard.topic">
<connection name="amqp" exchange="magento" />
</publisher>
</config>
@@ -0,0 +1,29 @@
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework-message-queue:etc/topology.xsd">
<exchange name="magento" connection="amqp" type="topic">
<binding id="async.binding1" topic="multi.topic.queue.topic.c" destinationType="queue" destination="queue.for.multiple.topics.test.c"/>
<binding id="async.binding2" topic="multi.topic.queue.topic.c" destinationType="queue" destination="mixed.sync.and.async.queue"/>
<binding id="async.binding3" topic="multi.topic.queue.topic.d" destinationType="queue" destination="queue.for.multiple.topics.test.d"/>
<binding id="async.binding4" topic="mtmh.topic.1" destinationType="queue" destination="mtmh.queue.1"/>
<binding id="async.binding5" topic="mtmh.topic.1" destinationType="queue" destination="mtmh.queue.2"/>
<binding id="async.binding6" topic="mtmh.topic.2" destinationType="queue" destination="mtmh.queue.1"/>
<binding id="async.binding7" topic="mtmh.topic.2" destinationType="queue" destination="mtmh.queue.2"/>
<binding id="async.binding8" topic="multi.topic.queue.topic.y" destinationType="queue" destination="queue.for.multiple.topics.test.y"/>
<binding id="async.binding9" topic="multi.topic.queue.topic.z" destinationType="queue" destination="queue.for.multiple.topics.test.z"/>
<binding id="wildCardBinding1" topic="#.wildcard" destinationType="queue" destination="wildcard.queue.one"/>
<binding id="wildCardBinding2" topic="*.*.segment3.wildcard" destinationType="queue" destination="wildcard.queue.two"/>
<binding id="wildCardBinding3" topic="*.segment3.wildcard" destinationType="queue" destination="wildcard.queue.three"/>
<binding id="wildCardBinding4" topic="#.segment3.*" destinationType="queue" destination="wildcard.queue.four"/>
</exchange>
</config>
@@ -0,0 +1,12 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
use Magento\Framework\Component\ComponentRegistrar;
$registrar = new ComponentRegistrar();
if ($registrar->getPath(ComponentRegistrar::MODULE, 'Magento_TestModuleAsyncAmqp') === null) {
ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_TestModuleAsyncAmqp', __DIR__);
}
@@ -0,0 +1,21 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Magento\TestModuleCatalogInventoryCache\Plugin;
class PreventCachingPreloadedStockDataInToStockRegistry
{
public function aroundSetStockItems(): void
{
//do not cache
}
public function aroundSetStockStatuses(): void
{
//do not cache
}
}
@@ -0,0 +1,12 @@
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="Magento\CatalogInventory\Model\StockRegistryPreloader">
<plugin name="prevent_caching_preloaded_stock_data" type="Magento\TestModuleCatalogInventoryCache\Plugin\PreventCachingPreloadedStockDataInToStockRegistry"/>
</type>
</config>
@@ -0,0 +1,10 @@
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Magento_TestModuleCatalogInventoryCache" />
</config>
@@ -0,0 +1,13 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
use Magento\Framework\Component\ComponentRegistrar;
$registrar = new ComponentRegistrar();
if ($registrar->getPath(ComponentRegistrar::MODULE, 'Magento_TestModuleCatalogInventoryCache') === null) {
ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_TestModuleCatalogInventoryCache', __DIR__);
}
@@ -0,0 +1,91 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Magento\TestModuleCatalogSearch\Model;
use Magento\Framework\App\Config\ScopeConfigInterface;
use Magento\TestFramework\Helper\Bootstrap;
use Magento\TestFramework\Helper\Curl;
/**
* Retrieve search engine version by curl request
*/
class SearchEngineVersionReader
{
private const SEARCH_ENGINE_PATH = 'catalog/search/engine';
/**
* @var array
*/
private $versionInfo;
/**
* Returns full search engine version e.g. 'elasticsearch7'
*
* @return string
*/
public function getFullVersion(): string
{
$version = $this->getVersion();
if (strtolower($this->getDistribution()) == 'opensearch') {
$version = 1;
}
return $this->getDistribution() . ($version === 1 ? '' : $version);
}
/**
* Returns search engine major version
*
* @return int
*/
public function getVersion() : int
{
$info = $this->getInfo();
$versionData = isset($info['version']['number']) ? explode('.', $info['version']['number']) : [];
return (int) array_shift($versionData);
}
/**
* Returns distribution name, e.g. 'opensearch'
*
* @return string
*/
public function getDistribution() : string
{
$info = $this->getInfo();
return $info['version']['distribution'] ?? 'elasticsearch';
}
/**
* Retrieve main info about search engine
*
* @return array
*/
private function getInfo(): array
{
if (!$this->versionInfo) {
$curl = new Curl();
$scopeConfig = Bootstrap::getObjectManager()->get(ScopeConfigInterface::class);
if ($scopeConfig->getValue(self::SEARCH_ENGINE_PATH)) {
$engine = $scopeConfig->getValue(self::SEARCH_ENGINE_PATH);
$serverHost = $scopeConfig->getValue("catalog/search/{$engine}_server_hostname");
$port = $scopeConfig->getValue("catalog/search/{$engine}_server_port");
$url = $serverHost . ':' . $port;
} else {
$url = 'http://localhost:9200';
}
$curl->get($url);
$curl->addHeader('content-type', 'application/json');
$data = $curl->getBody();
$this->versionInfo = json_decode($data, true);
}
return $this->versionInfo;
}
}
@@ -0,0 +1,14 @@
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Magento_TestModuleCatalogSearch">
<sequence>
<module name="Magento_CatalogSearch"/>
</sequence>
</module>
</config>
@@ -0,0 +1,12 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
use Magento\Framework\Component\ComponentRegistrar;
$registrar = new ComponentRegistrar();
if ($registrar->getPath(ComponentRegistrar::MODULE, 'Magento_TestModuleCatalogSearch') === null) {
ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_TestModuleCatalogSearch', __DIR__);
}
@@ -0,0 +1,40 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Magento\TestModuleControllerBackpressure\Controller\Read;
use Magento\Framework\App\Action\Action;
use Magento\Framework\App\Response\Http as HttpResponse;
class Read extends Action
{
/**
* @var int
*/
private int $counter = 0;
/**
* @inheritDoc
*/
public function execute()
{
/** @var HttpResponse $response */
$response = $this->getResponse();
return $response->representJson('{"str": "controller-read", "counter": ' .(++$this->counter) .'}');
}
public function resetCounter(): void
{
$this->counter = 0;
}
public function getCounter(): int
{
return $this->counter;
}
}
@@ -0,0 +1,24 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Magento\TestModuleControllerBackpressure\Model;
use Magento\Framework\App\Backpressure\ContextInterface;
use Magento\Framework\App\Backpressure\SlidingWindow\LimitConfig;
use Magento\Framework\App\Backpressure\SlidingWindow\LimitConfigManagerInterface;
class LimitConfigManager implements LimitConfigManagerInterface
{
/**
* @inheritDoc
*/
public function readLimit(ContextInterface $context): LimitConfig
{
return new LimitConfig(2, 60);
}
}
@@ -0,0 +1,28 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Magento\TestModuleControllerBackpressure\Model;
use Magento\Framework\App\ActionInterface;
use Magento\Framework\App\Request\Backpressure\RequestTypeExtractorInterface;
use Magento\Framework\App\RequestInterface;
class TypeExtractor implements RequestTypeExtractorInterface
{
/**
* @inheritDoc
*/
public function extract(RequestInterface $request, ActionInterface $action): ?string
{
if ($action instanceof Index) {
return 'testcontrollerbackpressure';
}
return null;
}
}
@@ -0,0 +1,21 @@
{
"name": "magento/module-test-controller-backpressure",
"description": "test controller module",
"config": {
"sort-packages": true
},
"require": {
"php": "~7.4.0||~8.0.0",
"magento/framework": "*",
"magento/module-integration": "*"
},
"type": "magento2-module",
"extra": {
"map": [
[
"*",
"Magento/TestModuleControllerBackpressure"
]
]
}
}
@@ -0,0 +1,27 @@
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="Magento\Framework\App\Request\Backpressure\CompositeRequestTypeExtractor">
<arguments>
<argument name="extractors" xsi:type="array">
<item name="controllertestbackpressure" xsi:type="object">
Magento\TestModuleControllerBackpressure\Model\TypeExtractor
</item>
</argument>
</arguments>
</type>
<type name="Magento\Framework\App\Backpressure\SlidingWindow\CompositeLimitConfigManager">
<arguments>
<argument name="configs" xsi:type="array">
<item name="testcontrollerbackpressure" xsi:type="object">
Magento\TestModuleControllerBackpressure\Model\LimitConfigManager
</item>
</argument>
</arguments>
</type>
</config>
@@ -0,0 +1,14 @@
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
<router id="standard">
<route id="testbackpressure" frontName="testbackpressure">
<module name="Magento_TestModuleControllerBackpressure" />
</route>
</router>
</config>
@@ -0,0 +1,10 @@
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Magento_TestModuleControllerBackpressure" />
</config>
@@ -0,0 +1,13 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
use Magento\Framework\Component\ComponentRegistrar;
$registrar = new ComponentRegistrar();
if ($registrar->getPath(ComponentRegistrar::MODULE, 'Magento_TestModuleControllerBackpressure') === null) {
ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_TestModuleControllerBackpressure', __DIR__);
}
@@ -0,0 +1,21 @@
{
"name": "magento/module-csp-config",
"description": "test csp module",
"config": {
"sort-packages": true
},
"require": {
"php": "~7.4.0||~8.0.0",
"magento/framework": "*",
"magento/module-integration": "*"
},
"type": "magento2-module",
"extra": {
"map": [
[
"*",
"Magento/TestModuleCspConfig"
]
]
}
}
@@ -0,0 +1,23 @@
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<csp_whitelist xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Csp/etc/csp_whitelist.xsd">
<policies>
<policy id="object-src">
<values>
<value id="example-base" type="host">example.magento.com</value>
<value id="mage-base" type="host">https://admin.magento.com</value>
</values>
</policy>
<policy id="media-src">
<values>
<value id="example-base" type="host">example.magento.com</value>
<value id="mage-base" type="host">https://admin.magento.com</value>
</values>
</policy>
</policies>
</csp_whitelist>
@@ -0,0 +1,24 @@
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<csp_whitelist xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Csp/etc/csp_whitelist.xsd">
<policies>
<policy id="object-src">
<values>
<value id="mage-base" type="host">https://magento.com</value>
<value id="hash" type="hash" algorithm="sha256">B2yPHKaXnvFWtRChIbabYmUBFZdVfKKXHbWtWidDVF8=</value>
<value id="hash2" type="hash" algorithm="sha256">B2yPHKaXnvFWtRChIbabYmUBFZdVfKKXHbWtWidDVF9=</value>
</values>
</policy>
<policy id="media-src">
<values>
<value id="mage-base" type="host">https://magento.com</value>
<value id="devdocs-base" type="host">https://devdocs.magento.com</value>
</values>
</policy>
</policies>
</csp_whitelist>
@@ -0,0 +1,10 @@
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Magento_TestModuleCspConfig" active="true" />
</config>
@@ -0,0 +1,12 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
use Magento\Framework\Component\ComponentRegistrar;
$registrar = new ComponentRegistrar();
if ($registrar->getPath(ComponentRegistrar::MODULE, 'Magento_TestModuleCspConfig') === null) {
ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_TestModuleCspConfig', __DIR__);
}
@@ -0,0 +1,21 @@
{
"name": "magento/module-csp-config2",
"description": "test csp module 2",
"config": {
"sort-packages": true
},
"require": {
"php": "~7.4.0||~8.0.0",
"magento/framework": "*",
"magento/module-integration": "*"
},
"type": "magento2-module",
"extra": {
"map": [
[
"*",
"Magento/TestModuleCspConfig2"
]
]
}
}
@@ -0,0 +1,17 @@
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<csp_whitelist xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Csp/etc/csp_whitelist.xsd">
<policies>
<policy id="object-src">
<values>
<value id="devdocs-base" type="host">https://devdocs.magento.com</value>
<value id="mage-base" type="host">http://magento.com</value>
</values>
</policy>
</policies>
</csp_whitelist>
@@ -0,0 +1,14 @@
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Magento_TestModuleCspConfig2" active="true">
<sequence>
<module name="Magento_TestModuleCspConfig"/>
</sequence>
</module>
</config>
@@ -0,0 +1,12 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
use Magento\Framework\Component\ComponentRegistrar;
$registrar = new ComponentRegistrar();
if ($registrar->getPath(ComponentRegistrar::MODULE, 'Magento_TestModuleCspConfig2') === null) {
ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_TestModuleCspConfig2', __DIR__);
}
@@ -0,0 +1,54 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Magento\TestModuleCspUtil\Controller\Csp;
use Magento\Csp\Api\CspAwareActionInterface;
use Magento\Csp\Model\Policy\FetchPolicy;
use Magento\Framework\App\Action\Action;
use Magento\Framework\Controller\ResultFactory;
/**
* CSP Aware controller.
*/
class Aware extends Action implements CspAwareActionInterface
{
/**
* @inheritDoc
*/
public function execute()
{
return $this->resultFactory->create(ResultFactory::TYPE_PAGE);
}
/**
* @inheritDoc
*/
public function modifyCsp(array $appliedPolicies): array
{
$policies = [];
foreach ($appliedPolicies as $policy) {
if ($policy instanceof FetchPolicy
&& in_array('http://controller.magento.com', $policy->getHostSources(), true)
) {
$policies[] = new FetchPolicy(
'script-src',
false,
['https://controller.magento.com'],
[],
true,
false,
false,
[],
['H4RRnauTM2X2Xg/z9zkno1crqhsaY3uKKu97uwmnXXE=' => 'sha256']
);
}
}
return $policies;
}
}
@@ -0,0 +1,26 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Magento\TestModuleCspUtil\Controller\Csp;
use Magento\Framework\App\Action\Action;
use Magento\Framework\Controller\ResultFactory;
use Magento\Framework\View\Result\PageFactory;
/**
* .phtml templates utilizes CSP helper.
*/
class Helper extends Action
{
/**
* @inheritDoc
*/
public function execute()
{
return $this->resultFactory->create(ResultFactory::TYPE_PAGE);
}
}
@@ -0,0 +1,21 @@
{
"name": "magento/module-csp-util",
"description": "test csp module",
"config": {
"sort-packages": true
},
"require": {
"php": "~7.4.0||~8.0.0",
"magento/framework": "*",
"magento/module-integration": "*"
},
"type": "magento2-module",
"extra": {
"map": [
[
"*",
"Magento/TestModuleCspUtil"
]
]
}
}
@@ -0,0 +1,16 @@
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<csp_whitelist xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Csp/etc/csp_whitelist.xsd">
<policies>
<policy id="script-src">
<values>
<value id="devdocs-base" type="host">https://devdocs.magento.com</value>
</values>
</policy>
</policies>
</csp_whitelist>
@@ -0,0 +1,14 @@
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
<router id="standard">
<route id="csputil" frontName="csputil">
<module name="Magento_TestModuleCspUtil" />
</route>
</router>
</config>
@@ -0,0 +1,10 @@
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Magento_TestModuleCspUtil" active="true" />
</config>
@@ -0,0 +1,12 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
use Magento\Framework\Component\ComponentRegistrar;
$registrar = new ComponentRegistrar();
if ($registrar->getPath(ComponentRegistrar::MODULE, 'Magento_TestModuleCspUtil') === null) {
ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_TestModuleCspUtil', __DIR__);
}
@@ -0,0 +1,17 @@
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="content">
<block class="Magento\Framework\View\Element\Template"
name="csp_helper"
cacheable="false"
template="Magento_TestModuleCspUtil::helper.phtml" />
</referenceContainer>
</body>
</page>
@@ -0,0 +1,17 @@
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="content">
<block class="Magento\Framework\View\Element\Template"
name="csp_helper"
cacheable="false"
template="Magento_TestModuleCspUtil::helper.phtml" />
</referenceContainer>
</body>
</page>
@@ -0,0 +1,12 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/** @var \Magento\Csp\Api\InlineUtilInterface $csp */
?>
<h1>Hello there!</h1>
<?= /* @noEscape */ $csp->renderTag('script', ['src' => 'http://my.magento.com/static/script.js']); ?>
<?= /* @noEscape */ $csp->renderTag('script', [], "\n let myVar = 1;\n") ?>
@@ -0,0 +1,10 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/** @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer */
?>
<?= /* @NoEscape */ $secureRenderer->renderTag('script', ['type' => 'text/javascript'], 'let var = 1; console.log("var = " + var);', false) ?>
<?= /* @NoEscape */ $secureRenderer->renderTag('script', ['type' => 'text/javascript', 'src' => 'https://magento.com/scripts/some-script.js']) ?>
@@ -0,0 +1,14 @@
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Magento_TestModuleDirectoryZipCodes" active="true">
<sequence>
<module name="Magento_Directory"/>
</sequence>
</module>
</config>
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Directory:etc/zip_codes.xsd">
<zip countryCode="NL">
<codes>
<code id="pattern_1" active="true" example="test1">^[0-9]{4}\s[a-zA-Z]{2}$</code>
<code id="pattern_2" active="true" example="test2">^[0-5]{4}[a-z]{2}$</code>
</codes>
</zip>
<zip countryCode="NL_NEW">
<codes>
<code id="pattern_1" active="true" example="test1">^[0-2]{4}[A-Z]{2}$</code>
</codes>
</zip>
</config>
@@ -0,0 +1,12 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
use Magento\Framework\Component\ComponentRegistrar;
$registrar = new ComponentRegistrar();
if ($registrar->getPath(ComponentRegistrar::MODULE, 'Magento_TestModuleDirectoryZipCodes') === null) {
ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_TestModuleDirectoryZipCodes', __DIR__);
}
@@ -0,0 +1,191 @@
<?php
/**
*
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Magento\TestModuleExtensionAttributes\Api\Data;
use Magento\Framework\Api\ExtensibleDataInterface;
/**
* Customer address interface.
*/
interface FakeAddressInterface extends ExtensibleDataInterface
{
/**#@+
* Constants for keys of data array
*/
const ID = 'id';
const CUSTOMER_ID = 'customer_id';
const REGION = 'region';
const REGIONS = 'regions';
const COUNTRY_ID = 'country_id';
const STREET = 'street';
const COMPANY = 'company';
const TELEPHONE = 'telephone';
const FAX = 'fax';
const POSTCODE = 'postcode';
const CITY = 'city';
const FIRSTNAME = 'firstname';
const LASTNAME = 'lastname';
const MIDDLENAME = 'middlename';
const PREFIX = 'prefix';
const SUFFIX = 'suffix';
const VAT_ID = 'vat_id';
const DEFAULT_BILLING = 'default_billing';
const DEFAULT_SHIPPING = 'default_shipping';
/**#@-*/
/**
* Get ID
*
* @return int|null
*/
public function getId();
/**
* Get customer ID
*
* @return int|null
*/
public function getCustomerId();
/**
* Get region
*
* @return \Magento\TestModuleExtensionAttributes\Api\Data\FakeRegionInterface|null
*/
public function getRegion();
/**
* Get region
*
* @return \Magento\TestModuleExtensionAttributes\Api\Data\FakeRegionInterface[]|null
*/
public function getRegions();
/**
* Two-letter country code in ISO_3166-2 format
*
* @return string|null
*/
public function getCountryId();
/**
* Get street
*
* @return string[]|null
*/
public function getStreet();
/**
* Get company
*
* @return string|null
*/
public function getCompany();
/**
* Get telephone number
*
* @return string|null
*/
public function getTelephone();
/**
* Get fax number
*
* @return string|null
*/
public function getFax();
/**
* Get postcode
*
* @return string|null
*/
public function getPostcode();
/**
* Get city name
*
* @return string|null
*/
public function getCity();
/**
* Get first name
*
* @return string|null
*/
public function getFirstname();
/**
* Get last name
*
* @return string|null
*/
public function getLastname();
/**
* Get middle name
*
* @return string|null
*/
public function getMiddlename();
/**
* Get prefix
*
* @return string|null
*/
public function getPrefix();
/**
* Get suffix
*
* @return string|null
*/
public function getSuffix();
/**
* Get Vat id
*
* @return string|null
*/
public function getVatId();
/**
* Get if this address is default shipping address.
*
* @return bool|null
*/
public function isDefaultShipping();
/**
* Get if this address is default billing address
*
* @return bool|null
*/
public function isDefaultBilling();
/**
* Retrieve existing extension attributes object or create a new one.
*
* @return \Magento\TestModuleExtensionAttributes\Api\Data\FakeAddressExtensionInterface|null
*/
public function getExtensionAttributes();
/**
* Set an extension attributes object.
*
* @param \Magento\TestModuleExtensionAttributes\Api\Data\FakeAddressExtensionInterface $extensionAttributes
* @return $this
*/
public function setExtensionAttributes(
\Magento\TestModuleExtensionAttributes\Api\Data\FakeAddressExtensionInterface $extensionAttributes
);
}
@@ -0,0 +1,68 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Magento\TestModuleExtensionAttributes\Api\Data;
/**
* Customer attribute metadata interface.
*/
interface FakeAttributeMetadataInterface extends \Magento\Framework\Api\MetadataObjectInterface
{
/**#@+
* Constants used as keys of data array
*/
const ATTRIBUTE_CODE = 'attribute_code';
const STORE_LABEL = 'store_label';
const FRONTEND_LABEL = 'frontend_label';
const NOTE = 'note';
/**#@-*/
/**
* Get label of the store.
*
* @return string
*/
public function getStoreLabel();
/**
* Set label of the store.
*
* @param string $storeLabel
* @return $this
*/
public function setStoreLabel($storeLabel);
/**
* Get label which supposed to be displayed on frontend.
*
* @return string
*/
public function getFrontendLabel();
/**
* Set label which supposed to be displayed on frontend.
*
* @param string $frontendLabel
* @return $this
*/
public function setFrontendLabel($frontendLabel);
/**
* Get the note attribute for the element.
*
* @return string
*/
public function getNote();
/**
* Set the note attribute for the element.
*
* @param string $note
* @return $this
*/
public function setNote($note);
}
@@ -0,0 +1,116 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Magento\TestModuleExtensionAttributes\Api\Data;
/**
* Customer interface.
*/
interface FakeCustomerInterface extends \Magento\Framework\Api\CustomAttributesDataInterface
{
/**#@+
* Constants defined for keys of the data array. Identical to the name of the getter in snake case
*/
const ID = 'id';
const EMAIL = 'email';
const FIRSTNAME = 'firstname';
const LASTNAME = 'lastname';
const PREFIX = 'prefix';
/**#@-*/
/**
* Get customer id
*
* @return int|null
*/
public function getId();
/**
* Set customer id
*
* @param int $id
* @return $this
*/
public function setId($id);
/**
* Get email address
*
* @return string
*/
public function getEmail();
/**
* Set email address
*
* @param string $email
* @return $this
*/
public function setEmail($email);
/**
* Get first name
*
* @return string
*/
public function getFirstname();
/**
* Set first name
*
* @param string $firstname
* @return $this
*/
public function setFirstname($firstname);
/**
* Get last name
*
* @return string
*/
public function getLastname();
/**
* Set last name
*
* @param string $lastname
* @return $this
*/
public function setLastname($lastname);
/**
* Get prefix
*
* @return string|null
*/
public function getPrefix();
/**
* Set prefix
*
* @param string $prefix
* @return $this
*/
public function setPrefix($prefix);
/**
* Retrieve existing extension attributes object or create a new one.
*
* @return \Magento\TestModuleExtensionAttributes\Api\Data\FakeCustomerExtensionInterface|null
*/
public function getExtensionAttributes();
/**
* Set an extension attributes object.
*
* @param \Magento\TestModuleExtensionAttributes\Api\Data\FakeCustomerExtensionInterface $extensionAttributes
* @return $this
*/
public function setExtensionAttributes(
\Magento\TestModuleExtensionAttributes\Api\Data\FakeCustomerExtensionInterface $extensionAttributes
);
}
@@ -0,0 +1,19 @@
<?php
/**
*
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Magento\TestModuleExtensionAttributes\Api\Data;
use Magento\Framework\Api\ExtensibleDataInterface;
/**
* Fake interface
* to test exception if the method 'getExtensionAttributes' is not overridden
*/
interface FakeExtensibleOneInterface extends ExtensibleDataInterface
{
}
@@ -0,0 +1,25 @@
<?php
/**
*
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Magento\TestModuleExtensionAttributes\Api\Data;
use Magento\Framework\Api\ExtensibleDataInterface;
/**
* Fake interface
* to test exception if the method 'getExtensionAttributes' does not return concrete type
*/
interface FakeExtensibleTwoInterface extends ExtensibleDataInterface
{
/**
* test incorrect return type
*
* @return int
*/
public function getExtensionAttributes();
}
@@ -0,0 +1,63 @@
<?php
/**
*
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Magento\TestModuleExtensionAttributes\Api\Data;
use Magento\Framework\Api\ExtensibleDataInterface;
/**
* Customer address region interface.
*/
interface FakeRegionInterface extends ExtensibleDataInterface
{
/**#@+
* Constants for keys of data array
*/
const REGION_CODE = 'region_code';
const REGION = 'region';
const REGION_ID = 'region_id';
/**#@-*/
/**
* Get region code
*
* @return string
*/
public function getRegionCode();
/**
* Get region
*
* @return string
*/
public function getRegion();
/**
* Get region id
*
* @return int
*/
public function getRegionId();
/**
* Retrieve existing extension attributes object or create a new one.
*
* @return \Magento\TestModuleExtensionAttributes\Api\Data\FakeRegionExtensionInterface|null
*/
public function getExtensionAttributes();
/**
* Set an extension attributes object.
*
* @param \Magento\TestModuleExtensionAttributes\Api\Data\FakeRegionExtensionInterface $extensionAttributes
* @return $this
*/
public function setExtensionAttributes(
\Magento\TestModuleExtensionAttributes\Api\Data\FakeRegionExtensionInterface $extensionAttributes
);
}
@@ -0,0 +1,227 @@
<?php
/**
*
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Magento\TestModuleExtensionAttributes\Model\Data;
use Magento\Framework\Api\AbstractExtensibleObject;
use Magento\TestModuleExtensionAttributes\Api\Data\FakeAddressInterface;
class FakeAddress extends AbstractExtensibleObject implements FakeAddressInterface
{
/**
* Get ID
*
* @return int|null
*/
public function getId()
{
return $this->_get(self::ID);
}
/**
* Get customer ID
*
* @return int|null
*/
public function getCustomerId()
{
return $this->_get(self::CUSTOMER_ID);
}
/**
* Get region
*
* @return \Magento\TestModuleExtensionAttributes\Model\Data\FakeRegion|null
*/
public function getRegion()
{
return $this->_get(self::REGION);
}
/**
* Get region
*
* @return \Magento\TestModuleExtensionAttributes\Model\Data\FakeRegion[]|null
*/
public function getRegions()
{
return $this->_get(self::REGIONS);
}
/**
* Two-letter country code in ISO_3166-2 format
*
* @return string|null
*/
public function getCountryId()
{
return $this->_get(self::COUNTRY_ID);
}
/**
* Get street
*
* @return string[]|null
*/
public function getStreet()
{
return $this->_get(self::STREET);
}
/**
* Get company
*
* @return string|null
*/
public function getCompany()
{
return $this->_get(self::COMPANY);
}
/**
* Get telephone number
*
* @return string|null
*/
public function getTelephone()
{
return $this->_get(self::TELEPHONE);
}
/**
* Get fax number
*
* @return string|null
*/
public function getFax()
{
return $this->_get(self::FAX);
}
/**
* Get postcode
*
* @return string|null
*/
public function getPostcode()
{
return $this->_get(self::POSTCODE);
}
/**
* Get city name
*
* @return string|null
*/
public function getCity()
{
return $this->_get(self::CITY);
}
/**
* Get first name
*
* @return string|null
*/
public function getFirstname()
{
return $this->_get(self::FIRSTNAME);
}
/**
* Get last name
*
* @return string|null
*/
public function getLastname()
{
return $this->_get(self::LASTNAME);
}
/**
* Get middle name
*
* @return string|null
*/
public function getMiddlename()
{
return $this->_get(self::MIDDLENAME);
}
/**
* Get prefix
*
* @return string|null
*/
public function getPrefix()
{
return $this->_get(self::PREFIX);
}
/**
* Get suffix
*
* @return string|null
*/
public function getSuffix()
{
return $this->_get(self::SUFFIX);
}
/**
* Get Vat id
*
* @return string|null
*/
public function getVatId()
{
return $this->_get(self::VAT_ID);
}
/**
* Get if this address is default shipping address.
*
* @return bool|null
*/
public function isDefaultShipping()
{
return $this->_get(self::DEFAULT_SHIPPING);
}
/**
* {@inheritdoc}
*
* @return \Magento\TestModuleExtensionAttributes\Api\Data\FakeAddressExtensionInterface|null
*/
public function getExtensionAttributes()
{
return $this->_getExtensionAttributes();
}
/**
* Get if this address is default billing address
*
* @return bool|null
*/
public function isDefaultBilling()
{
return $this->_get(self::DEFAULT_BILLING);
}
/**
* {@inheritdoc}
*
* @param \Magento\TestModuleExtensionAttributes\Api\Data\FakeAddressExtensionInterface $extensionAttributes
* @return $this
*/
public function setExtensionAttributes(
\Magento\TestModuleExtensionAttributes\Api\Data\FakeAddressExtensionInterface $extensionAttributes
) {
return $this->_setExtensionAttributes($extensionAttributes);
}
}
@@ -0,0 +1,91 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Magento\TestModuleExtensionAttributes\Model\Data;
/**
* Customer attribute metadata class.
*/
class FakeAttributeMetadata extends \Magento\Framework\Api\AbstractSimpleObject implements
\Magento\TestModuleExtensionAttributes\Api\Data\FakeAttributeMetadataInterface
{
/**
* {@inheritdoc}
*/
public function getAttributeCode()
{
return $this->_get(self::ATTRIBUTE_CODE);
}
/**
* {@inheritdoc}
*/
public function getStoreLabel()
{
return $this->_get(self::STORE_LABEL);
}
/**
* {@inheritdoc}
*/
public function getFrontendLabel()
{
return $this->_get(self::FRONTEND_LABEL);
}
/**
* {@inheritdoc}
*/
public function getNote()
{
return $this->_get(self::NOTE);
}
/**
* Set attribute code
*
* @param string $attributeCode
* @return $this
*/
public function setAttributeCode($attributeCode)
{
return $this->setData(self::ATTRIBUTE_CODE, $attributeCode);
}
/**
* Set label of the store.
*
* @param string $storeLabel
* @return $this
*/
public function setStoreLabel($storeLabel)
{
return $this->setData(self::STORE_LABEL, $storeLabel);
}
/**
* Set label which supposed to be displayed on frontend.
*
* @param string $frontendLabel
* @return $this
*/
public function setFrontendLabel($frontendLabel)
{
return $this->setData(self::FRONTEND_LABEL, $frontendLabel);
}
/**
* Set the note attribute for the element.
*
* @param string $note
* @return $this
*/
public function setNote($note)
{
return $this->setData(self::NOTE, $note);
}
}
@@ -0,0 +1,143 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Magento\TestModuleExtensionAttributes\Model\Data;
/**
* Class Customer
*
*/
class FakeCustomer extends \Magento\Framework\Api\AbstractExtensibleObject implements
\Magento\TestModuleExtensionAttributes\Api\Data\FakeCustomerInterface
{
/**
* Get email address
*
* @return string
*/
public function getEmail()
{
return $this->_get(self::EMAIL);
}
/**
* Get first name
*
* @return string
*/
public function getFirstname()
{
return $this->_get(self::FIRSTNAME);
}
/**
* Get customer id
*
* @return int|null
*/
public function getId()
{
return $this->_get(self::ID);
}
/**
* Get last name
*
* @return string
*/
public function getLastname()
{
return $this->_get(self::LASTNAME);
}
/**
* Set customer id
*
* @param int $id
* @return $this
*/
public function setId($id)
{
return $this->setData(self::ID, $id);
}
/**
* Set email address
*
* @param string $email
* @return $this
*/
public function setEmail($email)
{
return $this->setData(self::EMAIL, $email);
}
/**
* Set first name
*
* @param string $firstname
* @return $this
*/
public function setFirstname($firstname)
{
return $this->setData(self::FIRSTNAME, $firstname);
}
/**
* Set last name
*
* @param string $lastname
* @return string
*/
public function setLastname($lastname)
{
return $this->setData(self::LASTNAME, $lastname);
}
/**
* Get prefix
*
* @return string|null
*/
public function getPrefix()
{
return $this->_get(self::PREFIX);
}
/**
* Set prefix
*
* @param string $prefix
* @return $this
*/
public function setPrefix($prefix)
{
return $this->setData(self::PREFIX, $prefix);
}
/**
* {@inheritdoc}
*
* @return \Magento\TestModuleExtensionAttributes\Api\Data\FakeCustomerExtensionInterface|null
*/
public function getExtensionAttributes()
{
return $this->_getExtensionAttributes();
}
/**
* {@inheritdoc}
*
* @param \Magento\TestModuleExtensionAttributes\Api\Data\FakeCustomerExtensionInterface $extensionAttributes
* @return $this
*/
public function setExtensionAttributes(
\Magento\TestModuleExtensionAttributes\Api\Data\FakeCustomerExtensionInterface $extensionAttributes
) {
return $this->_setExtensionAttributes($extensionAttributes);
}
}
@@ -0,0 +1,15 @@
<?php
/**
*
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Magento\TestModuleExtensionAttributes\Model\Data;
use Magento\TestModuleExtensionAttributes\Api\Data\FakeExtensibleOneInterface;
class FakeExtensibleOne implements FakeExtensibleOneInterface
{
}
@@ -0,0 +1,23 @@
<?php
/**
*
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Magento\TestModuleExtensionAttributes\Model\Data;
use Magento\Framework\Api\AbstractExtensibleObject;
use Magento\TestModuleExtensionAttributes\Api\Data\FakeExtensibleTwoInterface;
class FakeExtensibleTwo extends AbstractExtensibleObject implements FakeExtensibleTwoInterface
{
/**
* {@inheritdoc}
*/
public function getExtensionAttributes()
{
return $this->_getExtensionAttributes();
}
}
@@ -0,0 +1,78 @@
<?php
/**
*
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Magento\TestModuleExtensionAttributes\Model\Data;
use Magento\TestModuleExtensionAttributes\Api\Data\FakeRegionInterface;
use Magento\Framework\Api\AbstractExtensibleObject;
class FakeRegion extends AbstractExtensibleObject implements FakeRegionInterface
{
/**
* Get region
*
* @return string
*/
public function getRegion()
{
return $this->_get(self::REGION);
}
/**
* Get region code
*
* @return string
*/
public function getRegionCode()
{
return $this->_get(self::REGION_CODE);
}
/**
* Get region id
*
* @return int
*/
public function getRegionId()
{
return $this->_get(self::REGION_ID);
}
/**
* {@inheritdoc}
*
* @return \Magento\TestModuleExtensionAttributes\Api\Data\FakeRegionExtensionInterface|null
*/
public function getExtensionAttributes()
{
return $this->_getExtensionAttributes();
}
/**
* {@inheritdoc}
*
* @param \Magento\TestModuleExtensionAttributes\Api\Data\FakeRegionExtensionInterface $extensionAttributes
* @return $this
*/
public function setExtensionAttributes(
\Magento\TestModuleExtensionAttributes\Api\Data\FakeRegionExtensionInterface $extensionAttributes
) {
return $this->_setExtensionAttributes($extensionAttributes);
}
/**
* Set region code
*
* @param string $regionCode
* @return $this
*/
public function setRegionCode($regionCode)
{
return $this->setData(self::REGION_CODE, $regionCode);
}
}
@@ -0,0 +1,227 @@
<?php
/**
*
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Magento\TestModuleExtensionAttributes\Model;
use Magento\Framework\Model\AbstractExtensibleModel;
use Magento\TestModuleExtensionAttributes\Api\Data\FakeAddressInterface;
class FakeAddress extends AbstractExtensibleModel implements FakeAddressInterface
{
/**
* Get ID
*
* @return int|null
*/
public function getId()
{
return $this->getData(self::ID);
}
/**
* Get customer ID
*
* @return int|null
*/
public function getCustomerId()
{
return $this->getData(self::CUSTOMER_ID);
}
/**
* Get region
*
* @return \Magento\TestModuleExtensionAttributes\Api\Data\FakeRegionInterface|null
*/
public function getRegion()
{
return $this->getData(self::REGION);
}
/**
* Get region
*
* @return \Magento\TestModuleExtensionAttributes\Api\Data\FakeRegionInterface[]|null
*/
public function getRegions()
{
return $this->getData(self::REGIONS);
}
/**
* Two-letter country code in ISO_3166-2 format
*
* @return string|null
*/
public function getCountryId()
{
return $this->getData(self::COUNTRY_ID);
}
/**
* Get street
*
* @return string[]|null
*/
public function getStreet()
{
return $this->getData(self::STREET);
}
/**
* Get company
*
* @return string|null
*/
public function getCompany()
{
return $this->getData(self::COMPANY);
}
/**
* Get telephone number
*
* @return string|null
*/
public function getTelephone()
{
return $this->getData(self::TELEPHONE);
}
/**
* Get fax number
*
* @return string|null
*/
public function getFax()
{
return $this->getData(self::FAX);
}
/**
* Get postcode
*
* @return string|null
*/
public function getPostcode()
{
return $this->getData(self::POSTCODE);
}
/**
* Get city name
*
* @return string|null
*/
public function getCity()
{
return $this->getData(self::CITY);
}
/**
* Get first name
*
* @return string|null
*/
public function getFirstname()
{
return $this->getData(self::FIRSTNAME);
}
/**
* Get last name
*
* @return string|null
*/
public function getLastname()
{
return $this->getData(self::LASTNAME);
}
/**
* Get middle name
*
* @return string|null
*/
public function getMiddlename()
{
return $this->getData(self::MIDDLENAME);
}
/**
* Get prefix
*
* @return string|null
*/
public function getPrefix()
{
return $this->getData(self::PREFIX);
}
/**
* Get suffix
*
* @return string|null
*/
public function getSuffix()
{
return $this->getData(self::SUFFIX);
}
/**
* Get Vat id
*
* @return string|null
*/
public function getVatId()
{
return $this->getData(self::VAT_ID);
}
/**
* Get if this address is default shipping address.
*
* @return bool|null
*/
public function isDefaultShipping()
{
return $this->getData(self::DEFAULT_SHIPPING);
}
/**
* Get if this address is default billing address
*
* @return bool|null
*/
public function isDefaultBilling()
{
return $this->getData(self::DEFAULT_BILLING);
}
/**
* {@inheritdoc}
*
* @return \Magento\TestModuleExtensionAttributes\Api\Data\FakeAddressExtensionInterface|null
*/
public function getExtensionAttributes()
{
return $this->_getExtensionAttributes();
}
/**
* {@inheritdoc}
*
* @param \Magento\TestModuleExtensionAttributes\Api\Data\FakeAddressExtensionInterface $extensionAttributes
* @return $this
*/
public function setExtensionAttributes(
\Magento\TestModuleExtensionAttributes\Api\Data\FakeAddressExtensionInterface $extensionAttributes
) {
return $this->_setExtensionAttributes($extensionAttributes);
}
}
@@ -0,0 +1,91 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Magento\TestModuleExtensionAttributes\Api\Model;
/**
* Customer attribute metadata class.
*/
class FakeAttributeMetadata extends \Magento\Framework\Api\AbstractSimpleObject implements
\Magento\TestModuleExtensionAttributes\Api\Data\FakeAttributeMetadataInterface
{
/**
* {@inheritdoc}
*/
public function getAttributeCode()
{
return $this->_get(self::ATTRIBUTE_CODE);
}
/**
* {@inheritdoc}
*/
public function getStoreLabel()
{
return $this->_get(self::STORE_LABEL);
}
/**
* {@inheritdoc}
*/
public function getFrontendLabel()
{
return $this->_get(self::FRONTEND_LABEL);
}
/**
* {@inheritdoc}
*/
public function getNote()
{
return $this->_get(self::NOTE);
}
/**
* Set attribute code
*
* @param string $attributeCode
* @return $this
*/
public function setAttributeCode($attributeCode)
{
return $this->setData(self::ATTRIBUTE_CODE, $attributeCode);
}
/**
* Set label of the store.
*
* @param string $storeLabel
* @return $this
*/
public function setStoreLabel($storeLabel)
{
return $this->setData(self::STORE_LABEL, $storeLabel);
}
/**
* Set label which supposed to be displayed on frontend.
*
* @param string $frontendLabel
* @return $this
*/
public function setFrontendLabel($frontendLabel)
{
return $this->setData(self::FRONTEND_LABEL, $frontendLabel);
}
/**
* Set the note attribute for the element.
*
* @param string $note
* @return $this
*/
public function setNote($note)
{
return $this->setData(self::NOTE, $note);
}
}
@@ -0,0 +1,143 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Magento\TestModuleExtensionAttributes\Api\Model;
/**
* Class Customer
*
*/
class FakeCustomer extends \Magento\Framework\Api\AbstractExtensibleObject implements
\Magento\TestModuleExtensionAttributes\Api\Data\FakeCustomerInterface
{
/**
* Get customer id
*
* @return int|null
*/
public function getId()
{
return $this->_get(self::ID);
}
/**
* Get email address
*
* @return string
*/
public function getEmail()
{
return $this->_get(self::EMAIL);
}
/**
* Get first name
*
* @return string
*/
public function getFirstname()
{
return $this->_get(self::FIRSTNAME);
}
/**
* Get last name
*
* @return string
*/
public function getLastname()
{
return $this->_get(self::LASTNAME);
}
/**
* Get prefix
*
* @return string|null
*/
public function getPrefix()
{
return $this->_get(self::PREFIX);
}
/**
* Set customer id
*
* @param int $id
* @return $this
*/
public function setId($id)
{
return $this->setData(self::ID, $id);
}
/**
* Set email address
*
* @param string $email
* @return $this
*/
public function setEmail($email)
{
return $this->setData(self::EMAIL, $email);
}
/**
* Set first name
*
* @param string $firstname
* @return $this
*/
public function setFirstname($firstname)
{
return $this->setData(self::FIRSTNAME, $firstname);
}
/**
* Set last name
*
* @param string $lastname
* @return string
*/
public function setLastname($lastname)
{
return $this->setData(self::LASTNAME, $lastname);
}
/**
* Set prefix
*
* @param string $prefix
* @return $this
*/
public function setPrefix($prefix)
{
return $this->setData(self::PREFIX, $prefix);
}
/**
* {@inheritdoc}
*
* @return \Magento\TestModuleExtensionAttributes\Api\Data\FakeCustomerExtensionInterface|null
*/
public function getExtensionAttributes()
{
return $this->_getExtensionAttributes();
}
/**
* {@inheritdoc}
*
* @param \Magento\TestModuleExtensionAttributes\Api\Data\FakeCustomerExtensionInterface $extensionAttributes
* @return $this
*/
public function setExtensionAttributes(
\Magento\TestModuleExtensionAttributes\Api\Data\FakeCustomerExtensionInterface $extensionAttributes
) {
return $this->_setExtensionAttributes($extensionAttributes);
}
}
@@ -0,0 +1,67 @@
<?php
/**
*
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Magento\TestModuleExtensionAttributes\Model;
use Magento\Framework\Model\AbstractExtensibleModel;
use Magento\TestModuleExtensionAttributes\Api\Data\FakeRegionInterface;
class FakeRegion extends AbstractExtensibleModel implements FakeRegionInterface
{
/**
* Get region
*
* @return string
*/
public function getRegion()
{
return $this->getData(self::REGION);
}
/**
* Get region code
*
* @return string
*/
public function getRegionCode()
{
return $this->getData(self::REGION_CODE);
}
/**
* Get region id
*
* @return int
*/
public function getRegionId()
{
return $this->getData(self::REGION_ID);
}
/**
* {@inheritdoc}
*
* @return \Magento\TestModuleExtensionAttributes\Api\Data\FakeRegionExtensionInterface|null
*/
public function getExtensionAttributes()
{
return $this->_getExtensionAttributes();
}
/**
* {@inheritdoc}
*
* @param \Magento\TestModuleExtensionAttributes\Api\Data\FakeRegionExtensionInterface $extensionAttributes
* @return $this
*/
public function setExtensionAttributes(
\Magento\TestModuleExtensionAttributes\Api\Data\FakeRegionExtensionInterface $extensionAttributes
) {
return $this->_setExtensionAttributes($extensionAttributes);
}
}
@@ -0,0 +1,97 @@
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Api/etc/extension_attributes.xsd">
<extension_attributes for="Magento\Catalog\Api\Data\ProductInterface">
<attribute code="test_stock_item" type="Magento\CatalogInventory\Api\Data\StockItemInterface">
<resources>
<resource ref="Magento_CatalogInventory::cataloginventory"/>
</resources>
<join reference_table="cataloginventory_stock_item"
join_on_field="entity_id"
reference_field="product_id"
>
<field>qty</field>
<field>item_id</field>
</join>
</attribute>
<attribute code="test_stock_item_qty" type="string">
<resources>
<resource ref="Magento_CatalogInventory::cataloginventory"/>
</resources>
<join reference_table="cataloginventory_stock_item"
join_on_field="entity_id"
reference_field="product_id"
>
<field>qty</field>
</join>
</attribute>
</extension_attributes>
<extension_attributes for="Magento\TestModuleExtensionAttributes\Api\Data\FakeCustomerInterface">
<attribute code="test_group_code" type="string">
<join reference_table="customer_group"
join_on_field="group_id"
reference_field="customer_group_id"
>
<field>customer_group_code</field>
</join>
</attribute>
</extension_attributes>
<extension_attributes for="Magento\Customer\Api\Data\CustomerInterface">
<attribute code="test_group_code" type="string">
<join reference_table="customer_group"
join_on_field="group_id"
reference_field="customer_group_id"
>
<field>customer_group_code</field>
</join>
</attribute>
<attribute code="test_group" type="Magento\Customer\Api\Data\GroupInterface">
<join reference_table="customer_group"
join_on_field="group_id"
reference_field="customer_group_id"
>
<field>tax_class_id</field>
<field column="customer_group_code">code</field>
</join>
</attribute>
</extension_attributes>
<extension_attributes for="Magento\Customer\Api\Data\GroupInterface">
<attribute code="test_dummy_attribute" type="string">
<join reference_table="eav_attribute"
reference_field="attribute_id"
join_on_field="customer_group_id"
>
<field>attribute_code</field>
</join>
</attribute>
<attribute code="test_complex_dummy_attribute" type="Magento\Catalog\Api\Data\ProductAttributeInterface">
<join reference_table="admin_user"
reference_field="user_id"
join_on_field="customer_group_id"
>
<field column="username">attribute_code</field>
<field column="firstname">frontend_label</field>
</join>
</attribute>
</extension_attributes>
<extension_attributes for="Magento\Sales\Api\Data\InvoiceInterface">
<attribute code="test_dummy_attribute" type="string">
<join reference_table="eav_attribute"
reference_field="attribute_id"
join_on_field="entity_id"
>
<field>attribute_code</field>
</join>
</attribute>
</extension_attributes>
</config>
@@ -0,0 +1,10 @@
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Magento_TestModuleExtensionAttributes" />
</config>
@@ -0,0 +1,13 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
use Magento\Framework\Component\ComponentRegistrar;
$registrar = new ComponentRegistrar();
if ($registrar->getPath(ComponentRegistrar::MODULE, 'Magento_TestModuleExtensionAttributes') === null) {
ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_TestModuleExtensionAttributes', __DIR__);
}
@@ -0,0 +1,19 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\TestModuleFakePaymentMethod\Gateway\Command;
use Magento\Payment\Gateway\CommandInterface;
class DoNothingCommand implements CommandInterface
{
/**
* @inheritDoc
*/
public function execute(array $commandSubject)
{
// This is fake. No action expected.
}
}
@@ -0,0 +1,42 @@
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
<default>
<payment>
<fake>
<model>Magento\TestModuleFakePaymentMethod\Gateway\Facade</model>
<title>Fake Payment Method</title>
<payment_action>authorize</payment_action>
<active>1</active>
<is_gateway>1</is_gateway>
<can_use_checkout>1</can_use_checkout>
<can_authorize>1</can_authorize>
<can_capture>1</can_capture>
<can_refund>1</can_refund>
<can_void>1</can_void>
<can_cancel>1</can_cancel>
<cctypes>AE,VI,MC,DI,JCB,CUP,DN,MI</cctypes>
<useccv>1</useccv>
<order_status>processing</order_status>
</fake>
<fake_vault>
<model>Magento\TestModuleFakePaymentMethod\Gateway\VaultFacade</model>
<title>Fake Payment Method Vault</title>
<active>1</active>
<instant_purchase>
<supported>1</supported>
</instant_purchase>
</fake_vault>
<fake_no_model>
<!-- This method on purpose does not have a 'model' node. -->
<title>Fake Payment Method without &lt;model&gt;</title>
<active>0</active>
</fake_no_model>
</payment>
</default>
</config>
@@ -0,0 +1,100 @@
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<!-- payment method config -->
<virtualType name="Magento\TestModuleFakePaymentMethod\Gateway\Facade" type="Magento\Payment\Model\Method\Adapter">
<arguments>
<argument name="code" xsi:type="string">fake</argument>
<argument name="formBlockType" xsi:type="string">Magento\Payment\Block\Form\Cc</argument>
<argument name="infoBlockType" xsi:type="string">Magento\Payment\Block\ConfigurableInfo</argument>
<argument name="valueHandlerPool" xsi:type="object">Magento\TestModuleFakePaymentMethod\Gateway\Config\ValueHandlerPool</argument>
<argument name="validatorPool" xsi:type="object">Magento\TestModuleFakePaymentMethod\Gateway\Validator\ValidatorPool</argument>
<argument name="commandPool" xsi:type="object">Magento\TestModuleFakePaymentMethod\Gateway\Command\CommandPool</argument>
</arguments>
</virtualType>
<virtualType name="Magento\TestModuleFakePaymentMethod\Gateway\Config\ValueHandlerPool" type="Magento\Payment\Gateway\Config\ValueHandlerPool">
<arguments>
<argument name="handlers" xsi:type="array">
<item name="default" xsi:type="string">Magento\TestModuleFakePaymentMethod\Gateway\Config\ConfigValueHandler</item>
</argument>
</arguments>
</virtualType>
<virtualType name="Magento\TestModuleFakePaymentMethod\Gateway\Config\ConfigValueHandler" type="Magento\Payment\Gateway\Config\ConfigValueHandler">
<arguments>
<argument name="configInterface" xsi:type="object">Magento\TestModuleFakePaymentMethod\Gateway\Config\Config</argument>
</arguments>
</virtualType>
<virtualType name="Magento\TestModuleFakePaymentMethod\Gateway\Config\Config" type="Magento\Payment\Gateway\Config\Config">
<arguments>
<argument name="methodCode" xsi:type="string">fake</argument>
</arguments>
</virtualType>
<virtualType name="Magento\TestModuleFakePaymentMethod\Gateway\Validator\ValidatorPool" type="Magento\Payment\Gateway\Validator\ValidatorPool">
<arguments>
<argument name="validators" xsi:type="array">
<!-- no validation -->
</argument>
</arguments>
</virtualType>
<virtualType name="Magento\TestModuleFakePaymentMethod\Gateway\Command\CommandPool" type="Magento\Payment\Gateway\Command\CommandPool">
<arguments>
<argument name="commands" xsi:type="array">
<item name="authorize" xsi:type="string">Magento\TestModuleFakePaymentMethod\Gateway\Command\DoNothingCommand</item>
<item name="sale" xsi:type="string">Magento\TestModuleFakePaymentMethod\Gateway\Command\DoNothingCommand</item>
<item name="capture" xsi:type="string">Magento\TestModuleFakePaymentMethod\Gateway\Command\DoNothingCommand</item>
<item name="settlement" xsi:type="string">Magento\TestModuleFakePaymentMethod\Gateway\Command\DoNothingCommand</item>
<item name="vault_authorize" xsi:type="string">Magento\TestModuleFakePaymentMethod\Gateway\Command\DoNothingCommand</item>
<item name="vault_sale" xsi:type="string">Magento\TestModuleFakePaymentMethod\Gateway\Command\DoNothingCommand</item>
<item name="vault_capture" xsi:type="string">Magento\TestModuleFakePaymentMethod\Gateway\Command\DoNothingCommand</item>
<item name="void" xsi:type="string">Magento\TestModuleFakePaymentMethod\Gateway\Command\DoNothingCommand</item>
<item name="refund" xsi:type="string">Magento\TestModuleFakePaymentMethod\Gateway\Command\DoNothingCommand</item>
<item name="cancel" xsi:type="string">Magento\TestModuleFakePaymentMethod\Gateway\Command\DoNothingCommand</item>
<item name="deny_payment" xsi:type="string">Magento\TestModuleFakePaymentMethod\Gateway\Command\DoNothingCommand</item>
</argument>
</arguments>
</virtualType>
<virtualType name="Magento\TestModuleFakePaymentMethod\Gateway\Command\CommandManager" type="Magento\Payment\Gateway\Command\CommandManager">
<arguments>
<argument name="commandPool" xsi:type="object">Magento\TestModuleFakePaymentMethod\Gateway\Command\CommandPool</argument>
</arguments>
</virtualType>
<type name="Magento\Payment\Gateway\Command\CommandManagerPool">
<arguments>
<argument name="executors" xsi:type="array">
<item name="fake" xsi:type="string">Magento\TestModuleFakePaymentMethod\Gateway\Command\CommandManager</item>
</argument>
</arguments>
</type>
<!-- vault config -->
<virtualType name="Magento\TestModuleFakePaymentMethod\Gateway\VaultFacade" type="Magento\Vault\Model\Method\Vault">
<arguments>
<argument name="config" xsi:type="object">Magento\TestModuleFakePaymentMethod\Gateway\Config\Vault\Config</argument>
<argument name="valueHandlerPool" xsi:type="object">Magento\TestModuleFakePaymentMethod\Gateway\Config\Vault\ValueHandlerPool</argument>
<argument name="vaultProvider" xsi:type="object">Magento\TestModuleFakePaymentMethod\Gateway\Facade</argument>
<argument name="code" xsi:type="string">fake_vault</argument>
</arguments>
</virtualType>
<virtualType name="Magento\TestModuleFakePaymentMethod\Gateway\Config\Vault\ValueHandlerPool" type="VaultPaymentValueHandlerPool">
<arguments>
<argument name="handlers" xsi:type="array">
<item name="default" xsi:type="string">Magento\TestModuleFakePaymentMethod\Gateway\Config\Vault\ConfigValueHandler</item>
</argument>
</arguments>
</virtualType>
<virtualType name="Magento\TestModuleFakePaymentMethod\Gateway\Config\Vault\ConfigValueHandler" type="VaultPaymentDefaultValueHandler">
<arguments>
<argument name="configInterface" xsi:type="object">Magento\TestModuleFakePaymentMethod\Gateway\Config\Vault\Config</argument>
</arguments>
</virtualType>
<virtualType name="Magento\TestModuleFakePaymentMethod\Gateway\Config\Vault\Config" type="Magento\Payment\Gateway\Config\Config">
<arguments>
<argument name="methodCode" xsi:type="string">fake_vault</argument>
</arguments>
</virtualType>
</config>
@@ -0,0 +1,16 @@
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Magento_TestModuleFakePaymentMethod">
<sequence>
<module name="Magento_Sales"/>
<module name="Magento_Payment"/>
<module name="Magento_Checkout"/>
</sequence>
</module>
</config>
@@ -0,0 +1,12 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
use Magento\Framework\Component\ComponentRegistrar;
$registrar = new ComponentRegistrar();
if ($registrar->getPath(ComponentRegistrar::MODULE, 'Magento_TestModuleFakePaymentMethod') === null) {
ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_TestModuleFakePaymentMethod', __DIR__);
}
@@ -0,0 +1,24 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Magento\TestModuleGraphQlBackpressure\Model;
use Magento\Framework\App\Backpressure\ContextInterface;
use Magento\Framework\App\Backpressure\SlidingWindow\LimitConfig;
use Magento\Framework\App\Backpressure\SlidingWindow\LimitConfigManagerInterface;
class LimitConfigManager implements LimitConfigManagerInterface
{
/**
* @inheritDoc
*/
public function readLimit(ContextInterface $context): LimitConfig
{
return new LimitConfig(2, 60);
}
}
@@ -0,0 +1,41 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Magento\TestModuleGraphQlBackpressure\Model;
use Magento\Framework\GraphQl\Config\Element\Field;
use Magento\Framework\GraphQl\Query\ResolverInterface;
use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;
class TestServiceResolver implements ResolverInterface
{
/**
* @var int
*/
private int $counter = 0;
/**
* @inheritDoc
*/
public function resolve(Field $field, $context, ResolveInfo $info, array $value = null, array $args = null)
{
$this->counter++;
return ['str' => 'read'];
}
public function resetCounter(): void
{
$this->counter = 0;
}
public function getCounter(): int
{
return $this->counter;
}
}
@@ -0,0 +1,27 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Magento\TestModuleGraphQlBackpressure\Model;
use Magento\Framework\GraphQl\Config\Element\Field;
use Magento\GraphQl\Model\Backpressure\RequestTypeExtractorInterface;
class TypeExtractor implements RequestTypeExtractorInterface
{
/**
* @inheritDoc
*/
public function extract(Field $field): ?string
{
if ($field->getResolver() == TestServiceResolver::class) {
return 'testgraphqlbackpressure';
}
return null;
}
}
@@ -0,0 +1,21 @@
{
"name": "magento/module-test-graphql-backpressure",
"description": "test graphql module",
"config": {
"sort-packages": true
},
"require": {
"php": "~7.4.0||~8.0.0",
"magento/framework": "*",
"magento/module-integration": "*"
},
"type": "magento2-module",
"extra": {
"map": [
[
"*",
"Magento/TestModuleGraphQlBackpressure"
]
]
}
}
@@ -0,0 +1,29 @@
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for="Magento\TestModuleGraphQlBackpressure\Api\TestReadServiceInterface"
type="Magento\TestModuleGraphQlBackpressure\Model\TestReadService" />
<type name="Magento\GraphQl\Model\Backpressure\CompositeRequestTypeExtractor">
<arguments>
<argument name="extractors" xsi:type="array">
<item name="graphqltestbackpressure" xsi:type="object">
Magento\TestModuleGraphQlBackpressure\Model\TypeExtractor
</item>
</argument>
</arguments>
</type>
<type name="Magento\Framework\App\Backpressure\SlidingWindow\CompositeLimitConfigManager">
<arguments>
<argument name="configs" xsi:type="array">
<item name="testgraphqlbackpressure" xsi:type="object">
Magento\TestModuleGraphQlBackpressure\Model\LimitConfigManager
</item>
</argument>
</arguments>
</type>
</config>
@@ -0,0 +1,10 @@
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Magento_TestModuleGraphQlBackpressure" />
</config>
@@ -0,0 +1,14 @@
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
<router id="standard">
<route id="moduletestgraphqlback" frontName="moduletestgraphqlback">
<module name="Magento_TestModuleGraphQlBackpressure" />
</route>
</router>
</config>
@@ -0,0 +1,10 @@
# Copyright © Magento, Inc. All rights reserved.
# See COPYING.txt for license details.
type TestReadOutput {
str: String
}
type Query {
testGraphqlRead: TestReadOutput @resolver(class: "Magento\\TestModuleGraphQlBackpressure\\Model\\TestServiceResolver") @cache(cacheable: false)
}
@@ -0,0 +1,13 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
use Magento\Framework\Component\ComponentRegistrar;
$registrar = new ComponentRegistrar();
if ($registrar->getPath(ComponentRegistrar::MODULE, 'Magento_TestModuleGraphQlBackpressure') === null) {
ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_TestModuleGraphQlBackpressure', __DIR__);
}
@@ -0,0 +1,18 @@
{
"name": "magento/module-test-module-message-queue-config-override",
"description": "test module for message queue configuration",
"require": {
"php": "~7.4.0||~8.0.0",
"magento/framework": "*",
"magento/module-integration": "*"
},
"type": "magento2-module",
"extra": {
"map": [
[
"*",
"Magento/TestModuleMessageQueueConfigOverride"
]
]
}
}
@@ -0,0 +1,10 @@
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Magento_TestModuleMessageQueueConfigOverride" />
</config>
@@ -0,0 +1,26 @@
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework-message-queue:etc/topology.xsd">
<exchange name="magento-topic-based-exchange1" connection="amqp">
<arguments>
<argument name="alternate-exchange" xsi:type="string">magento-log-exchange</argument>
</arguments>
</exchange>
<exchange name="magento-topic-based-exchange2" type="topic" connection="amqp">
<arguments>
<argument name="alternate-exchange" xsi:type="string">magento-log-exchange</argument>
</arguments>
<binding id="topicBasedRouting2">
<arguments>
<argument name="argument2" xsi:type="boolean">true</argument>
<argument name="argument3" xsi:type="number">150</argument>
</arguments>
</binding>
</exchange>
</config>
@@ -0,0 +1,15 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
use Magento\Framework\Component\ComponentRegistrar;
$registrar = new ComponentRegistrar();
if ($registrar->getPath(ComponentRegistrar::MODULE, 'Magento_TestModuleMessageQueueConfigOverride') === null) {
ComponentRegistrar::register(
ComponentRegistrar::MODULE,
'Magento_TestModuleMessageQueueConfigOverride',
__DIR__
);
}
@@ -0,0 +1,41 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\TestModuleMessageQueueConfiguration;
/**
* Class for testing asynchronous queue handlers.
*
* @SuppressWarnings(PHPMD)
*/
class AsyncHandler
{
/**
* @param string
* @return void
*/
public function methodWithStringParam($param)
{
return;
}
/**
* @param bool
* @return void
*/
public function methodWithBoolParam($param)
{
return;
}
/**
* @param mixed
* @return void
*/
public function methodWithMixedParam($param)
{
return;
}
}
@@ -0,0 +1,42 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\TestModuleMessageQueueConfiguration;
/**
* Class for testing queue handlers.
*/
class HandlerOne
{
/**
* Return true.
*
* @return bool
*/
public function handlerMethodOne()
{
return true;
}
/**
* Return true.
*
* @return bool
*/
public function handlerMethodTwo()
{
return true;
}
/**
* Return true.
*
* @return bool
*/
public function handlerMethodThree()
{
return true;
}
}
@@ -0,0 +1,42 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\TestModuleMessageQueueConfiguration;
/**
* Class for testing queue handlers.
*/
class HandlerTwo
{
/**
* Return true.
*
* @return bool
*/
public function handlerMethodOne()
{
return true;
}
/**
* Return true.
*
* @return bool
*/
public function handlerMethodTwo()
{
return true;
}
/**
* Return true.
*
* @return bool
*/
public function handlerMethodThree()
{
return true;
}
}
@@ -0,0 +1,39 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\TestModuleMessageQueueConfiguration;
/**
* Class for testing synchronous queue handlers.
*/
class SyncHandler
{
/**
* @param string
* @return string
*/
public function methodWithStringParam($param)
{
return 'Processed: ' . $param;
}
/**
* @param bool
* @return bool
*/
public function methodWithBoolParam($param)
{
return !$param;
}
/**
* @param mixed
* @return mixed
*/
public function methodWithMixedParam($param)
{
return $param;
}
}
@@ -0,0 +1,18 @@
{
"name": "magento/module-test-module-message-queue-configuration",
"description": "test module for message queue configuration",
"require": {
"php": "~7.4.0||~8.0.0",
"magento/framework": "*",
"magento/module-integration": "*"
},
"type": "magento2-module",
"extra": {
"map": [
[
"*",
"Magento/TestModuleMessageQueueConfiguration"
]
]
}
}
@@ -0,0 +1,25 @@
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Communication/etc/communication.xsd">
<topic name="deprecated.config.async.bool.topic" request="bool">
<handler name="handler1" type="Magento\TestModuleMessageQueueConfiguration\AsyncHandler" method="methodWithBoolParam"/>
<handler name="handler2" type="Magento\TestModuleMessageQueueConfiguration\AsyncHandler" method="methodWithMixedParam"/>
</topic>
<topic name="deprecated.config.async.string.topic" request="string"/>
<topic name="deprecated.config.sync.string.topic" request="string" response="string">
<handler name="handler1" type="Magento\TestModuleMessageQueueConfiguration\SyncHandler" method="methodWithStringParam"/>
</topic>
<topic name="deprecated.config.sync.bool.topic" schema="Magento\TestModuleMessageQueueConfiguration\SyncHandler::methodWithBoolParam">
<handler name="handler1" type="Magento\TestModuleMessageQueueConfiguration\SyncHandler" method="methodWithBoolParam"/>
</topic>
<topic name="overlapping.topic.declaration" request="string">
<handler name="handler1" type="Magento\TestModuleMessageQueueConfiguration\AsyncHandler" method="methodWithStringParam"/>
</topic>
<topic name="anotherTopic1" request="string"/>
<topic name="anotherTopic2" request="string"/>
</config>
@@ -0,0 +1,11 @@
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Magento_TestModuleMessageQueueConfiguration" >
</module>
</config>
@@ -0,0 +1,22 @@
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework-message-queue:etc/queue.xsd">
<broker topic="deprecated.config.async.string.topic">
<queue consumer="deprecatedConfigAsyncStringConsumer" name="deprecated.config.queue.1" consumerInstance="Magento\Framework\MessageQueue\BatchConsumer" maxMessages="200"/>
<queue consumer="deprecatedConfigAsyncMixedConsumer" name="deprecated.config.queue.3" handler="Magento\TestModuleMessageQueueConfiguration\AsyncHandler::methodWithMixedParam"/>
</broker>
<broker topic="deprecated.config.async.bool.topic" type="db" exchange="deprecatedExchange">
<queue consumer="deprecatedConfigAsyncBoolConsumer" name="deprecated.config.queue.2" />
</broker>
<broker topic="deprecated.config.sync.bool.topic" type="db" exchange="customExchange">
<queue consumer="deprecatedConfigSyncBoolConsumer" name="deprecated.config.queue.4"/>
</broker>
<broker topic="overlapping.topic.declaration" exchange="overlappingDeprecatedExchange">
<queue consumer="overlappingConsumerDeclaration" name="consumer.config.queue" consumerInstance="Magento\Framework\MessageQueue\BatchConsumer" maxMessages="222" handler="Magento\TestModuleMessageQueueConfiguration\AsyncHandler::methodWithMixedParam"/>
</broker>
</config>
@@ -0,0 +1,15 @@
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework-message-queue:etc/consumer.xsd">
<consumer name="consumer1" queue="queue1" handler="Magento\TestModuleMessageQueueConfiguration\HandlerOne::handlerMethodOne" consumerInstance="Magento\Framework\MessageQueue\BatchConsumer" connection="amqp" maxMessages="100"/>
<consumer name="consumer2" queue="queue2" handler="Magento\TestModuleMessageQueueConfiguration\HandlerOne::handlerMethodTwo" consumerInstance="Magento\Framework\MessageQueue\BatchConsumer" connection="db"/>
<consumer name="consumer3" queue="queue3" handler="Magento\TestModuleMessageQueueConfiguration\HandlerTwo::handlerMethodOne" consumerInstance="Magento\Framework\MessageQueue\BatchConsumer"/>
<consumer name="consumer4" queue="queue4" handler="Magento\TestModuleMessageQueueConfiguration\HandlerOne::handlerMethodOne"/>
<consumer name="consumer5" queue="queue5"/>
<consumer name="overlappingConsumerDeclaration" queue="consumer.config.queue" connection="amqp"/>
</config>
@@ -0,0 +1,22 @@
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework-message-queue:etc/publisher.xsd">
<publisher topic="topic.message.queue.config.01">
<connection name="amqp" exchange="magento2" />
<connection name="db" exchange="magento2" disabled="true" />
</publisher>
<publisher topic="topic.message.queue.config.02">
<connection name="amqp" exchange="magento2" disabled="true"/>
<connection name="db" exchange="magento2" disabled="true" />
</publisher>
<publisher topic="topic.message.queue.config.03" disabled="true" />
<publisher topic="topic.message.queue.config.04">
<connection name="amqp" />
</publisher>
<publisher topic="overlapping.topic.declaration"/>
</config>
@@ -0,0 +1,46 @@
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework-message-queue:etc/topology.xsd">
<exchange name="magento-topic-based-exchange1" type="topic" connection="amqp">
<binding id="topicBasedRouting1" topic="anotherTopic1" destinationType="queue" destination="topic-queue1">
<arguments>
<argument name="argument1" xsi:type="string">value</argument>
</arguments>
</binding>
</exchange>
<exchange name="magento-topic-based-exchange2" connection="amqp">
<binding id="topicBasedRouting2" topic="anotherTopic2" destination="topic-queue2" destinationType="queue">
<arguments>
<argument name="argument1" xsi:type="string">value</argument>
</arguments>
</binding>
<arguments>
<argument name="arrayValue" xsi:type="array">
<item name="element01" xsi:type="string">10</item>
<item name="element02" xsi:type="string">20</item>
</argument>
</arguments>
</exchange>
<exchange name="magento-topic-based-exchange3" type="topic" connection="amqp" autoDelete="true" durable="false" internal="true" />
<exchange name="magento-topic-based-exchange4" type="topic" connection="amqp">
<binding id="wildcard1" destination="topic-queue1" destinationType="queue" topic="#">
<arguments>
<argument name="test" xsi:type="string">one</argument>
</arguments>
</binding>
<binding id="wildcard2" destination="topic-queue2" destinationType="queue" topic="*.*.*" />
</exchange>
<exchange name="overlappingDeprecatedExchange" type="topic">
<binding id="binding1" topic="overlapping.topic.declaration" destinationType="queue" destination="topology.config.queue" />
<binding id="binding2" topic="deprecated.config.async.string.topic" destinationType="queue" destination="topology.config.queue" />
</exchange>
</config>
@@ -0,0 +1,12 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
use Magento\Framework\Component\ComponentRegistrar;
$registrar = new ComponentRegistrar();
if ($registrar->getPath(ComponentRegistrar::MODULE, 'Magento_TestModuleMessageQueueConfiguration') === null) {
ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_TestModuleMessageQueueConfiguration', __DIR__);
}
@@ -0,0 +1,10 @@
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Magento_TestModuleMview"/>
</config>

Some files were not shown because too many files have changed in this diff Show More