Class SessionTest
Definition at line 21 of file SessionTest.php.
◆ _validateCustomerDataInQuote()
_validateCustomerDataInQuote |
( |
|
$quote | ) |
|
|
protected |
Ensure that quote has customer data specified in customer fixture.
- Parameters
-
\Magento\Quote\Model\Quote | $quote | |
Definition at line 189 of file SessionTest.php.
193 $customerFirstNameFromFixture =
'John';
195 $customerEmailFromFixture,
196 $quote->getCustomerEmail(),
197 'Customer email was not set to Quote correctly.' 202 'Customer ID was not set to Quote correctly.' 205 $customerFirstNameFromFixture,
206 $quote->getCustomerFirstname(),
207 'Customer first name was not set to Quote correctly.'
◆ setUp()
- Returns
- void
Definition at line 46 of file SessionTest.php.
49 $this->customerRepository = $this->objectManager->create(CustomerRepositoryInterface::class);
50 $this->customerSession = $this->objectManager->get(CustomerSession::class);
51 $this->checkoutSession = $this->objectManager->create(Session::class);
static getObjectManager()
◆ testGetQuoteNotInitializedCustomerLoggedIn()
testGetQuoteNotInitializedCustomerLoggedIn |
( |
| ) |
|
Test covers case when quote is not yet initialized and customer data is set to customer session model.
Expected result - quote object should be loaded and customer data should be set to it.
@magentoDataFixture Magento/Sales/_files/quote_with_customer.php @magentoAppIsolation enabled
Execute SUT
Definition at line 79 of file SessionTest.php.
81 $customer = $this->customerRepository->getById(1);
82 $this->customerSession->setCustomerDataObject(
$customer);
85 $quote = $this->checkoutSession->getQuote();
_validateCustomerDataInQuote($quote)
◆ testGetQuoteNotInitializedCustomerSet()
testGetQuoteNotInitializedCustomerSet |
( |
| ) |
|
Test covers case when quote is not yet initialized and customer data is set to checkout session model.
Expected result - quote object should be loaded and customer data should be set to it.
@magentoDataFixture Magento/Sales/_files/quote_with_customer.php
Execute SUT
Definition at line 61 of file SessionTest.php.
63 $customer = $this->customerRepository->getById(1);
64 $this->checkoutSession->setCustomerData(
$customer);
67 $quote = $this->checkoutSession->getQuote();
_validateCustomerDataInQuote($quote)
◆ testLoadCustomerQuoteCustomerWithoutQuote()
testLoadCustomerQuoteCustomerWithoutQuote |
( |
| ) |
|
Tes merging of customer data into initialized quote object.
Conditions:
- Quote without customer data is set to checkout session
- Customer without associated quote is set to checkout session
Expected result: Quote which is set to checkout session should contain customer data
@magentoDataFixture Magento/Customer/_files/customer.php @magentoAppIsolation enabled
Ensure that customer data is still unavailable before SUT invocation
Execute SUT
Definition at line 102 of file SessionTest.php.
104 $quote = $this->checkoutSession->getQuote();
105 $this->assertEmpty(
$quote->getCustomerId(),
'Precondition failed: Customer data must not be set to quote');
106 $this->assertEmpty(
$quote->getCustomerEmail(),
'Precondition failed: Customer data must not be set to quote');
108 $customer = $this->customerRepository->getById(1);
109 $this->customerSession->setCustomerDataObject(
$customer);
112 $quote = $this->checkoutSession->getQuote();
113 $this->assertEmpty(
$quote->getCustomerEmail(),
'Precondition failed: Customer data must not be set to quote');
116 $this->checkoutSession->loadCustomerQuote();
117 $quote = $this->checkoutSession->getQuote();
_validateCustomerDataInQuote($quote)
The documentation for this class was generated from the following file:
- vendor/magento/magento2-base/dev/tests/integration/testsuite/Magento/Checkout/Model/SessionTest.php