Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions
ConfigTest Class Reference
Inheritance diagram for ConfigTest:

Public Member Functions

 testGetTopics ()
 
 testGetTopicsNumeric ()
 
 testGetTopicsNumericInvalid ()
 
 testGetTopic ()
 
 testGetTopicInvalidName ()
 
 testGetTopicsExceptionMissingRequest ()
 
 testGetTopicsExceptionNotExistingServiceMethod ()
 
 testGetTopicsExceptionNotExistingService ()
 
 testGetTopicsExceptionNoAttributes ()
 
 testGetTopicsExceptionInvalidResponseSchema ()
 
 testGetTopicsExceptionInvalidRequestSchema ()
 
 testGetTopicsExceptionMultipleHandlersSynchronousMode ()
 
 testGetTopicsExceptionInvalidHandler ()
 
 testGetTopicsExceptionInvalidTopicNameInEnv ()
 
 testGetTopicsExceptionTopicWithoutDataInEnv ()
 
 testGetTopicsExceptionTopicWithMissedKeysInEnv ()
 
 testGetTopicsExceptionTopicWithExcessiveKeysInEnv ()
 
 testGetTopicsExceptionTopicWithNonMatchedNameInEnv ()
 
 testGetTopicsExceptionMultipleHandlersSynchronousModeInEnv ()
 
 testGetTopicsExceptionInvalidRequestSchemaInEnv ()
 
 testGetTopicsExceptionInvalidResponseSchemaInEnv ()
 
 testGetTopicsExceptionInvalidMethodInHandlerInEnv ()
 
 testGetTopicsExceptionWithDisabledHandlerInEnv ()
 
 testGetTopicsExceptionIncorrectRequestSchemaTypeInEnv ()
 
 testGetTopicsExceptionIsNotBooleanTypeOfIsSynchronousInEnv ()
 

Detailed Description

Test of communication configuration reading and parsing.

@magentoCache config disabled

Definition at line 13 of file ConfigTest.php.

Member Function Documentation

◆ testGetTopic()

testGetTopic ( )

Get topic configuration by its name

Definition at line 65 of file ConfigTest.php.

66  {
67  $topics = $this->getConfigInstance(__DIR__ . '/_files/valid_communication.xml')->getTopic('customerCreated');
68  $expectedParsedTopics = include __DIR__ . '/_files/valid_communication_expected.php';
69  $this->assertEquals($expectedParsedTopics['customerCreated'], $topics);
70  }
defined('TESTS_BP')||define('TESTS_BP' __DIR__
Definition: _bootstrap.php:60

◆ testGetTopicInvalidName()

testGetTopicInvalidName ( )

Get topic configuration by its name

@expectedException \Magento\Framework\Exception\LocalizedException @expectedExceptionMessage Topic "invalidTopic" is not configured.

Definition at line 78 of file ConfigTest.php.

79  {
80  $this->getConfigInstance(__DIR__ . '/_files/valid_communication.xml')->getTopic('invalidTopic');
81  }
defined('TESTS_BP')||define('TESTS_BP' __DIR__
Definition: _bootstrap.php:60

◆ testGetTopics()

testGetTopics ( )

Check how valid communication XML config is parsed.

Definition at line 18 of file ConfigTest.php.

19  {
20  $topics = $this->getConfigInstance(__DIR__ . '/_files/valid_communication.xml')->getTopics();
21  $expectedParsedTopics = include __DIR__ . '/_files/valid_communication_expected.php';
22  $this->assertEquals($expectedParsedTopics, $topics);
23  }
defined('TESTS_BP')||define('TESTS_BP' __DIR__
Definition: _bootstrap.php:60

◆ testGetTopicsExceptionIncorrectRequestSchemaTypeInEnv()

testGetTopicsExceptionIncorrectRequestSchemaTypeInEnv ( )

@expectedException \LogicException @expectedExceptionMessage Request schema type for topic "customerCreated" must be "object_interface" or "service_

Definition at line 279 of file ConfigTest.php.

280  {
281  $this->getConfigInstance(
282  __DIR__ . '/_files/valid_communication.xml',
283  __DIR__ . '/_files/communication_incorrect_request_schema_type.php'
284  )->getTopics();
285  }
defined('TESTS_BP')||define('TESTS_BP' __DIR__
Definition: _bootstrap.php:60

◆ testGetTopicsExceptionInvalidHandler()

testGetTopicsExceptionInvalidHandler ( )

@expectedException \LogicException @expectedExceptionMessage Service method specified in the definition of handler "customHandler" for topic "custo

Definition at line 150 of file ConfigTest.php.

151  {
152  $this->getConfigInstance(__DIR__ . '/_files/communication_not_existing_handler_method.xml')->getTopics();
153  }
defined('TESTS_BP')||define('TESTS_BP' __DIR__
Definition: _bootstrap.php:60

◆ testGetTopicsExceptionInvalidMethodInHandlerInEnv()

testGetTopicsExceptionInvalidMethodInHandlerInEnv ( )

@expectedException \LogicException @expectedExceptionMessage Service method specified in the definition of handler "customerCreatedFirst" for topic

Definition at line 255 of file ConfigTest.php.

256  {
257  $this->getConfigInstance(
258  __DIR__ . '/_files/valid_communication.xml',
259  __DIR__ . '/_files/communication_not_existing_handler_method.php'
260  )->getTopics();
261  }
defined('TESTS_BP')||define('TESTS_BP' __DIR__
Definition: _bootstrap.php:60

◆ testGetTopicsExceptionInvalidRequestSchema()

testGetTopicsExceptionInvalidRequestSchema ( )

@expectedException \LogicException @expectedExceptionMessage Request schema definition for topic "customerUpdated" should reference existing

Definition at line 132 of file ConfigTest.php.

133  {
134  $this->getConfigInstance(__DIR__ . '/_files/communication_request_not_existing_service.xml')->getTopics();
135  }
defined('TESTS_BP')||define('TESTS_BP' __DIR__
Definition: _bootstrap.php:60

◆ testGetTopicsExceptionInvalidRequestSchemaInEnv()

testGetTopicsExceptionInvalidRequestSchemaInEnv ( )

@expectedException \LogicException @expectedExceptionMessage Request schema definition for topic "customerCreated" should reference existing service

Definition at line 231 of file ConfigTest.php.

232  {
233  $this->getConfigInstance(
234  __DIR__ . '/_files/valid_communication.xml',
235  __DIR__ . '/_files/communication_request_not_existing_service.php'
236  )->getTopics();
237  }
defined('TESTS_BP')||define('TESTS_BP' __DIR__
Definition: _bootstrap.php:60

◆ testGetTopicsExceptionInvalidResponseSchema()

testGetTopicsExceptionInvalidResponseSchema ( )

@expectedException \LogicException @expectedExceptionMessage Response schema definition for topic "customerUpdated" should reference existing

Definition at line 123 of file ConfigTest.php.

124  {
125  $this->getConfigInstance(__DIR__ . '/_files/communication_response_not_existing_service.xml')->getTopics();
126  }
defined('TESTS_BP')||define('TESTS_BP' __DIR__
Definition: _bootstrap.php:60

◆ testGetTopicsExceptionInvalidResponseSchemaInEnv()

testGetTopicsExceptionInvalidResponseSchemaInEnv ( )

@expectedException \LogicException @expectedExceptionMessage Response schema definition for topic "customerCreated" should reference existing type o

Definition at line 243 of file ConfigTest.php.

244  {
245  $this->getConfigInstance(
246  __DIR__ . '/_files/valid_communication.xml',
247  __DIR__ . '/_files/communication_response_not_existing_service.php'
248  )->getTopics();
249  }
defined('TESTS_BP')||define('TESTS_BP' __DIR__
Definition: _bootstrap.php:60

◆ testGetTopicsExceptionInvalidTopicNameInEnv()

testGetTopicsExceptionInvalidTopicNameInEnv ( )

@expectedException \LogicException @expectedExceptionMessage Topic name "customerAdded" and attribute "name" = "customerCreated" must be equal

Definition at line 159 of file ConfigTest.php.

160  {
161  $this->getConfigInstance(
162  __DIR__ . '/_files/valid_communication.xml',
163  __DIR__ . '/_files/communication_invalid_topic_name.php'
164  )->getTopics();
165  }
defined('TESTS_BP')||define('TESTS_BP' __DIR__
Definition: _bootstrap.php:60

◆ testGetTopicsExceptionIsNotBooleanTypeOfIsSynchronousInEnv()

testGetTopicsExceptionIsNotBooleanTypeOfIsSynchronousInEnv ( )

@expectedException \LogicException @expectedExceptionMessage The attribute "is_synchronous" for topic "customerCreated" should have the value of the

Definition at line 291 of file ConfigTest.php.

292  {
293  $this->getConfigInstance(
294  __DIR__ . '/_files/valid_communication.xml',
295  __DIR__ . '/_files/communication_is_synchronous_is_not_boolean.php'
296  )->getTopics();
297  }
defined('TESTS_BP')||define('TESTS_BP' __DIR__
Definition: _bootstrap.php:60

◆ testGetTopicsExceptionMissingRequest()

testGetTopicsExceptionMissingRequest ( )

@expectedException \LogicException @expectedExceptionMessage Either "request" or "schema" attribute must be specified for topic "customerUpdated"

Definition at line 87 of file ConfigTest.php.

88  {
89  $this->getConfigInstance(__DIR__ . '/_files/communication_missing_request.xml')->getTopics();
90  }
defined('TESTS_BP')||define('TESTS_BP' __DIR__
Definition: _bootstrap.php:60

◆ testGetTopicsExceptionMultipleHandlersSynchronousMode()

testGetTopicsExceptionMultipleHandlersSynchronousMode ( )

@expectedException \LogicException @expectedExceptionMessage Topic "customerDeleted" is configured for synchronous requests, that is why it must

Definition at line 141 of file ConfigTest.php.

142  {
143  $this->getConfigInstance(__DIR__ . '/_files/communication_multiple_handlers_synchronous_mode.xml')->getTopics();
144  }
defined('TESTS_BP')||define('TESTS_BP' __DIR__
Definition: _bootstrap.php:60

◆ testGetTopicsExceptionMultipleHandlersSynchronousModeInEnv()

testGetTopicsExceptionMultipleHandlersSynchronousModeInEnv ( )

@expectedException \LogicException @expectedExceptionMessage Topic "customerDeleted" is configured for synchronous requests, that is why it must

Definition at line 219 of file ConfigTest.php.

220  {
221  $this->getConfigInstance(
222  __DIR__ . '/_files/valid_communication.xml',
223  __DIR__ . '/_files/communication_multiple_handlers_synchronous_mode.php'
224  )->getTopics();
225  }
defined('TESTS_BP')||define('TESTS_BP' __DIR__
Definition: _bootstrap.php:60

◆ testGetTopicsExceptionNoAttributes()

testGetTopicsExceptionNoAttributes ( )

@expectedException \LogicException @expectedExceptionMessage Either "request" or "schema" attribute must be specified for topic "customerRetrieved"

Definition at line 114 of file ConfigTest.php.

115  {
116  $this->getConfigInstance(__DIR__ . '/_files/communication_no_attributes.xml')->getTopics();
117  }
defined('TESTS_BP')||define('TESTS_BP' __DIR__
Definition: _bootstrap.php:60

◆ testGetTopicsExceptionNotExistingService()

testGetTopicsExceptionNotExistingService ( )

@expectedException \LogicException @expectedExceptionMessage Service method specified in the definition of topic "customerRetrieved" is not

Definition at line 105 of file ConfigTest.php.

106  {
107  $this->getConfigInstance(__DIR__ . '/_files/communication_not_existing_service.xml')->getTopics();
108  }
defined('TESTS_BP')||define('TESTS_BP' __DIR__
Definition: _bootstrap.php:60

◆ testGetTopicsExceptionNotExistingServiceMethod()

testGetTopicsExceptionNotExistingServiceMethod ( )

@expectedException \LogicException @expectedExceptionMessage Service method specified in the definition of topic "customerRetrieved" is not

Definition at line 96 of file ConfigTest.php.

97  {
98  $this->getConfigInstance(__DIR__ . '/_files/communication_not_existing_service_method.xml')->getTopics();
99  }
defined('TESTS_BP')||define('TESTS_BP' __DIR__
Definition: _bootstrap.php:60

◆ testGetTopicsExceptionTopicWithExcessiveKeysInEnv()

testGetTopicsExceptionTopicWithExcessiveKeysInEnv ( )

@expectedException \LogicException @expectedExceptionMessage Topic "customerCreated" has excessive keys: [some_incorrect_key]

Definition at line 195 of file ConfigTest.php.

196  {
197  $this->getConfigInstance(
198  __DIR__ . '/_files/valid_communication.xml',
199  __DIR__ . '/_files/communication_topic_with_excessive_keys.php'
200  )->getTopics();
201  }
defined('TESTS_BP')||define('TESTS_BP' __DIR__
Definition: _bootstrap.php:60

◆ testGetTopicsExceptionTopicWithMissedKeysInEnv()

testGetTopicsExceptionTopicWithMissedKeysInEnv ( )

@expectedException \LogicException @expectedExceptionMessage Topic "customerCreated" has missed keys: [response]

Definition at line 183 of file ConfigTest.php.

184  {
185  $this->getConfigInstance(
186  __DIR__ . '/_files/valid_communication.xml',
187  __DIR__ . '/_files/communication_topic_with_missed_keys.php'
188  )->getTopics();
189  }
defined('TESTS_BP')||define('TESTS_BP' __DIR__
Definition: _bootstrap.php:60

◆ testGetTopicsExceptionTopicWithNonMatchedNameInEnv()

testGetTopicsExceptionTopicWithNonMatchedNameInEnv ( )

@expectedException \LogicException @expectedExceptionMessage Topic name "customerDeleted" and attribute "name" = "customerRemoved" must be equal

Definition at line 207 of file ConfigTest.php.

208  {
209  $this->getConfigInstance(
210  __DIR__ . '/_files/valid_communication.xml',
211  __DIR__ . '/_files/communication_with_non_matched_name.php'
212  )->getTopics();
213  }
defined('TESTS_BP')||define('TESTS_BP' __DIR__
Definition: _bootstrap.php:60

◆ testGetTopicsExceptionTopicWithoutDataInEnv()

testGetTopicsExceptionTopicWithoutDataInEnv ( )

@expectedException \LogicException @expectedExceptionMessage Topic "customerCreated" must contain data

Definition at line 171 of file ConfigTest.php.

172  {
173  $this->getConfigInstance(
174  __DIR__ . '/_files/valid_communication.xml',
175  __DIR__ . '/_files/communication_topic_without_data.php'
176  )->getTopics();
177  }
defined('TESTS_BP')||define('TESTS_BP' __DIR__
Definition: _bootstrap.php:60

◆ testGetTopicsExceptionWithDisabledHandlerInEnv()

testGetTopicsExceptionWithDisabledHandlerInEnv ( )

@expectedException \LogicException @expectedExceptionMessage Disabled handler "default" for topic "customerCreated" cannot be added to the config fi

Definition at line 267 of file ConfigTest.php.

268  {
269  $this->getConfigInstance(
270  __DIR__ . '/_files/valid_communication.xml',
271  __DIR__ . '/_files/communication_with_disabled_handler.php'
272  )->getTopics();
273  }
defined('TESTS_BP')||define('TESTS_BP' __DIR__
Definition: _bootstrap.php:60

◆ testGetTopicsNumeric()

testGetTopicsNumeric ( )

Get topic configuration by its name

@expectedException \LogicException @expectedExceptionMessage Service method specified in the definition of topic "customerDeletedNumbers" is not av

Definition at line 31 of file ConfigTest.php.

32  {
33  $this->getConfigInstance(__DIR__ . '/_files/valid_communication_numeric.xml')->getTopics();
34  }
defined('TESTS_BP')||define('TESTS_BP' __DIR__
Definition: _bootstrap.php:60

◆ testGetTopicsNumericInvalid()

testGetTopicsNumericInvalid ( )

Get topic configuration by its name

@expectedException \Magento\Framework\Exception\LocalizedException @expectedExceptionMessage The XML in file "0" is invalid: 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 Verify the XML and try again.

Definition at line 57 of file ConfigTest.php.

58  {
59  $this->getConfigInstance(__DIR__ . '/_files/invalid_communication_numeric.xml')->getTopics();
60  }
defined('TESTS_BP')||define('TESTS_BP' __DIR__
Definition: _bootstrap.php:60

The documentation for this class was generated from the following file: