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

Public Member Functions

 testGetServiceMetadata ()
 
 testGetRouteMetadata ()
 

Protected Member Functions

 setUp ()
 

Detailed Description

Definition at line 12 of file ServiceMetadataTest.php.

Member Function Documentation

◆ setUp()

setUp ( )
protected

Definition at line 19 of file ServiceMetadataTest.php.

20  {
22  $this->serviceMetadata = $objectManager->create(ServiceMetadata::class);
23  }
$objectManager
Definition: bootstrap.php:17

◆ testGetRouteMetadata()

testGetRouteMetadata ( )

Definition at line 74 of file ServiceMetadataTest.php.

75  {
76  $expected = [
77  'methods' => [
78  'activate' => [
79  'method' => 'activate',
80  'inputRequired' => false,
81  'isSecure' => false,
82  'resources' => [
83  'Magento_Customer::manage'
84  ],
85  'documentation' => 'Activate a customer account using a key that was sent in a confirmation email.',
86  'interface' => [
87  'in' => [
88  'parameters' => [
89  'email' => [
90  'type' => 'string',
91  'required' => true,
92  'documentation' => null
93  ],
94  'confirmationKey' => [
95  'type' => 'string',
96  'required' => true,
97  'documentation' => null
98  ]
99  ]
100  ],
101  'out' => [
102  'parameters' => [
103  'result' => [
104  'type' => 'CustomerDataCustomerInterface',
105  'required' => true,
106  'documentation' => ''
107  ]
108  ],
109  'throws' => [
110  '\\' . LocalizedException::class
111  ]
112  ]
113  ]
114  ]
115  ],
116  'class' => AccountManagementInterface::class,
117  'description' => 'Interface for managing customers accounts.',
118  'routes' => [
119  '/V1/customers/me/activate' => [
120  'PUT' => [
121  'method' => 'activateById',
122  'parameters' => [
123  'customerId' => [
124  'force' => true,
125  'value' => '%customer_id%'
126  ]
127  ]
128  ]
129  ]
130  ]
131  ];
132  $actual = $this->serviceMetadata->getRouteMetadata('customerAccountManagementV1');
133  $this->assertEquals(array_replace_recursive($actual, $expected), $actual);
134  }

◆ testGetServiceMetadata()

testGetServiceMetadata ( )

Definition at line 25 of file ServiceMetadataTest.php.

26  {
27  $expected = [
28  'methods' => [
29  'activate' => [
30  'method' => 'activate',
31  'inputRequired' => false,
32  'isSecure' => false,
33  'resources' => [
34  'Magento_Customer::manage'
35  ],
36  'documentation' => 'Activate a customer account using a key that was sent in a confirmation email.',
37  'interface' => [
38  'in' => [
39  'parameters' => [
40  'email' => [
41  'type' => 'string',
42  'required' => true,
43  'documentation' => null
44  ],
45  'confirmationKey' => [
46  'type' => 'string',
47  'required' => true,
48  'documentation' => null
49  ]
50  ]
51  ],
52  'out' => [
53  'parameters' => [
54  'result' => [
55  'type' => 'CustomerDataCustomerInterface',
56  'required' => true,
57  'documentation' => ''
58  ]
59  ],
60  'throws' => [
61  '\\' . LocalizedException::class
62  ]
63  ]
64  ]
65  ]
66  ],
67  'class' => AccountManagementInterface::class,
68  'description' => 'Interface for managing customers accounts.',
69  ];
70  $actual = $this->serviceMetadata->getServiceMetadata('customerAccountManagementV1');
71  $this->assertEquals(array_replace_recursive($actual, $expected), $actual);
72  }

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