Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Data Fields | Protected Member Functions | Protected Attributes
CartManagementTest Class Reference
Inheritance diagram for CartManagementTest:
WebapiAbstract

Public Member Functions

 testCreateEmptyCartForGuest ()
 
 testAssignCustomerThrowsExceptionIfThereIsNoCartWithGivenId ()
 
- Public Member Functions inherited from WebapiAbstract
 addModelToDelete ($model, $secure=false)
 
 processRestExceptionResult (\Exception $e)
 

Data Fields

const SERVICE_VERSION = 'V1'
 
const SERVICE_NAME = 'quoteCartManagementV1'
 
const RESOURCE_PATH = '/V1/carts/'
 
const RESOURCE_PATH_CUSTOMER_TOKEN = "/V1/integration/customer/token"
 
- Data Fields inherited from WebapiAbstract
const AUTO_TEAR_DOWN_DISABLED = 0
 
const AUTO_TEAR_DOWN_AFTER_METHOD = 1
 
const AUTO_TEAR_DOWN_AFTER_CLASS = 2
 
const ADAPTER_SOAP = 'soap'
 
const ADAPTER_REST = 'rest'
 

Protected Member Functions

 setUp ()
 
- Protected Member Functions inherited from WebapiAbstract
 tearDown ()
 
 _webApiCall ( $serviceInfo, $arguments=[], $webApiAdapterCode=null, $storeCode=null, $integration=null)
 
 _markTestAsSoapOnly ($message=null)
 
 _markTestAsRestOnly ($message=null)
 
 _getWebApiAdapter ($webApiAdapterCode)
 
 _assertMessagesEqual ($expectedMessages, $receivedMessages)
 
 _cleanAppConfigCache ()
 
 _restoreAppConfig ()
 
 checkSoapFault ( $soapFault, $expectedMessage, $expectedFaultCode, $expectedErrorParams=[], $expectedWrappedErrors=[], $traceString=null)
 
 _checkFaultParams ($expectedErrorParams, $errorDetails)
 
 _checkWrappedErrors ($expectedWrappedErrors, $errorDetails)
 

Protected Attributes

 $createdQuotes = []
 
 $objectManager
 
- Protected Attributes inherited from WebapiAbstract
 $_appCache
 
 $_modelsToDelete = []
 
 $_origConfigValues = []
 
 $_webApiAdapters
 
 $_webApiAdaptersMap
 

Additional Inherited Members

- Static Public Member Functions inherited from WebapiAbstract
static setUpBeforeClass ()
 
static tearDownAfterClass ()
 
static setFixture ($key, $fixture, $tearDown=self::AUTO_TEAR_DOWN_AFTER_METHOD)
 
static getFixture ($key)
 
static callModelDelete ($model, $secure=false)
 
static deleteFixture ($key, $secure=false)
 
- Static Protected Member Functions inherited from WebapiAbstract
static _setFixtureNamespace ()
 
static _unsetFixtureNamespace ()
 
static _getFixtureNamespace ()
 
static _deleteFixtures ($fixtures)
 
- Static Protected Attributes inherited from WebapiAbstract
static $_fixturesNamespace
 
static $_fixtures = []
 
static $_methodLevelFixtures = []
 
static $_classLevelFixtures = []
 

Detailed Description

Definition at line 17 of file CartManagementTest.php.

Member Function Documentation

◆ setUp()

setUp ( )
protected

Definition at line 31 of file CartManagementTest.php.

32  {
34  $appConfig = $this->objectManager->get(Config::class);
35  $appConfig->clean();
36  }

◆ testAssignCustomerThrowsExceptionIfThereIsNoCartWithGivenId()

testAssignCustomerThrowsExceptionIfThereIsNoCartWithGivenId ( )

@magentoApiDataFixture Magento/Customer/_files/customer.php @expectedException \Exception

Definition at line 213 of file CartManagementTest.php.

214  {
215  $cartId = 9999;
216  $customerId = 1;
217  $serviceInfo = [
218  'soap' => [
219  'service' => self::SERVICE_NAME,
220  'serviceVersion' => 'V1',
221  'operation' => self::SERVICE_NAME . 'AssignCustomer',
222  ],
223  'rest' => [
224  'resourcePath' => '/V1/carts/' . $cartId,
226  ],
227  ];
228  $requestData = [
229  'cartId' => $cartId,
230  'customerId' => $customerId,
231  'storeId' => 1,
232  ];
233 
234  $this->_webApiCall($serviceInfo, $requestData);
235  }
_webApiCall( $serviceInfo, $arguments=[], $webApiAdapterCode=null, $storeCode=null, $integration=null)
$cartId
Definition: quote.php:22

◆ testCreateEmptyCartForGuest()

testCreateEmptyCartForGuest ( )

Definition at line 48 of file CartManagementTest.php.

49  {
50  $serviceInfo = [
51  'rest' => [
52  'resourcePath' => self::RESOURCE_PATH,
54  ],
55  'soap' => [
56  'service' => self::SERVICE_NAME,
57  'serviceVersion' => self::SERVICE_VERSION,
58  'operation' => self::SERVICE_NAME . 'CreateEmptyCart',
59  ],
60  ];
61 
62  $requestData = ['storeId' => 1];
63  $quoteId = $this->_webApiCall($serviceInfo, $requestData);
64  $this->assertGreaterThan(0, $quoteId);
65  $this->createdQuotes[] = $quoteId;
66  }
_webApiCall( $serviceInfo, $arguments=[], $webApiAdapterCode=null, $storeCode=null, $integration=null)

Field Documentation

◆ $createdQuotes

$createdQuotes = []
protected

Definition at line 24 of file CartManagementTest.php.

◆ $objectManager

$objectManager
protected

Definition at line 29 of file CartManagementTest.php.

◆ RESOURCE_PATH

const RESOURCE_PATH = '/V1/carts/'

Definition at line 21 of file CartManagementTest.php.

◆ RESOURCE_PATH_CUSTOMER_TOKEN

const RESOURCE_PATH_CUSTOMER_TOKEN = "/V1/integration/customer/token"

Definition at line 22 of file CartManagementTest.php.

◆ SERVICE_NAME

const SERVICE_NAME = 'quoteCartManagementV1'

Definition at line 20 of file CartManagementTest.php.

◆ SERVICE_VERSION

const SERVICE_VERSION = 'V1'

Definition at line 19 of file CartManagementTest.php.


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