diff --git a/dev/tests/integration/testsuite/Magento/Framework/Communication/ConfigTest.php b/dev/tests/integration/testsuite/Magento/Framework/Communication/ConfigTest.php index fa0cd6dd1c239..d4e576d9449d7 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/Communication/ConfigTest.php +++ b/dev/tests/integration/testsuite/Magento/Framework/Communication/ConfigTest.php @@ -22,6 +22,40 @@ public function testGetTopics() $this->assertEquals($expectedParsedTopics, $topics); } + /** + * Get topic configuration by its name + * + * @expectedException \LogicException + * @expectedExceptionMessage Service method specified in the definition of topic "customerDeletedNumbers" is not available. Given "V55\Customer\Api\CustomerRepositoryInterface::delete99" + */ + public function testGetTopicsNumeric() + { + $this->getConfigInstance(__DIR__ . '/_files/valid_communication_numeric.xml')->getTopics(); + } + + /** + * Get topic configuration by its name + * + * @expectedException \Magento\Framework\Exception\LocalizedException + * @expectedExceptionMessage Invalid XML in file 0: + Element 'topic', attribute 'schema': [facet 'pattern'] The value '55\Customer\Api\CustomerRepositoryInterface::delete' is not accepted by the pattern '[a-zA-Z]+[a-zA-Z0-9\\]+::[a-zA-Z0-9]+'. + Line: 9 + + Element 'topic', attribute 'schema': '55\Customer\Api\CustomerRepositoryInterface::delete' is not a valid value of the atomic type 'schemaType'. + Line: 9 + + Element 'handler', attribute 'type': [facet 'pattern'] The value '55\Customer\Api\CustomerRepositoryInterface' is not accepted by the pattern '[a-zA-Z]+[a-zA-Z0-9\\]+'. + Line: 10 + + Element 'handler', attribute 'type': '55\Customer\Api\CustomerRepositoryInterface' is not a valid value of the atomic type 'serviceTypeType'. + Line: 10 + * + */ + public function testGetTopicsNumericInvalid() + { + $this->getConfigInstance(__DIR__ . '/_files/invalid_communication_numeric.xml')->getTopics(); + } + /** * Get topic configuration by its name */ diff --git a/dev/tests/integration/testsuite/Magento/Framework/Communication/_files/invalid_communication_numeric.xml b/dev/tests/integration/testsuite/Magento/Framework/Communication/_files/invalid_communication_numeric.xml new file mode 100644 index 0000000000000..a18b5e6254e52 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Framework/Communication/_files/invalid_communication_numeric.xml @@ -0,0 +1,12 @@ + + + + + + + diff --git a/dev/tests/integration/testsuite/Magento/Framework/Communication/_files/valid_communication_numeric.xml b/dev/tests/integration/testsuite/Magento/Framework/Communication/_files/valid_communication_numeric.xml new file mode 100644 index 0000000000000..97c92163be91f --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Framework/Communication/_files/valid_communication_numeric.xml @@ -0,0 +1,12 @@ + + + + + + + diff --git a/lib/internal/Magento/Framework/Communication/Config/ConfigParser.php b/lib/internal/Magento/Framework/Communication/Config/ConfigParser.php index 39d1635124ea7..b8beef99ccf41 100644 --- a/lib/internal/Magento/Framework/Communication/Config/ConfigParser.php +++ b/lib/internal/Magento/Framework/Communication/Config/ConfigParser.php @@ -25,7 +25,7 @@ class ConfigParser */ public function parseServiceMethod($serviceMethod) { - $pattern = '/^([a-zA-Z\\\\]+)::([a-zA-Z]+)$/'; + $pattern = '/^([a-zA-Z]+[a-zA-Z0-9\\\\]+)::([a-zA-Z0-9]+)$/'; preg_match($pattern, $serviceMethod, $matches); if (!isset($matches[1]) || !isset($matches[2])) { throw new LocalizedException( diff --git a/lib/internal/Magento/Framework/Communication/Config/Reader/XmlReader/Converter.php b/lib/internal/Magento/Framework/Communication/Config/Reader/XmlReader/Converter.php index 49b5e4dfd556f..4acc295ea2000 100644 --- a/lib/internal/Magento/Framework/Communication/Config/Reader/XmlReader/Converter.php +++ b/lib/internal/Magento/Framework/Communication/Config/Reader/XmlReader/Converter.php @@ -19,7 +19,7 @@ class Converter implements \Magento\Framework\Config\ConverterInterface { /** * @deprecated - * @see ConfigParser::SERVICE_METHOD_NAME_PATTERN + * @see ConfigParser::parseServiceMethod */ const SERVICE_METHOD_NAME_PATTERN = '/^([a-zA-Z\\\\]+)::([a-zA-Z]+)$/'; diff --git a/lib/internal/Magento/Framework/Communication/etc/communication.xsd b/lib/internal/Magento/Framework/Communication/etc/communication.xsd index b2c0777a7a02f..1b91ada103b88 100644 --- a/lib/internal/Magento/Framework/Communication/etc/communication.xsd +++ b/lib/internal/Magento/Framework/Communication/etc/communication.xsd @@ -54,7 +54,7 @@ - + @@ -76,7 +76,7 @@ - +