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

Public Member Functions

 testDefaultCustomerTaxClass ()
 
 testGetDefaultRateRequest ()
 

Data Fields

const FIXTURE_CUSTOMER_ID = 1
 
const FIXTURE_ADDRESS_ID = 1
 

Protected Attributes

 $_objectManager
 
 $customerRepository
 
 $addressRepository
 
 $groupRepository
 
 $_model
 

Detailed Description

Class CalculationTest

@magentoDataFixture Magento/Customer/_files/customer.php @magentoDataFixture Magento/Customer/_files/customer_address.php

Definition at line 18 of file CalculationTest.php.

Member Function Documentation

◆ testDefaultCustomerTaxClass()

testDefaultCustomerTaxClass ( )

Definition at line 63 of file CalculationTest.php.

64  {
65  $defaultCustomerTaxClass = 3;
66  $this->assertEquals($defaultCustomerTaxClass, $this->_model->getDefaultCustomerTaxClass(null));
67  }

◆ testGetDefaultRateRequest()

testGetDefaultRateRequest ( )

Definition at line 69 of file CalculationTest.php.

70  {
71  $customerDataSet = $this->customerRepository->getById(self::FIXTURE_CUSTOMER_ID);
72  $address = $this->addressRepository->getById(self::FIXTURE_ADDRESS_ID);
73 
74  $rateRequest = $this->_model->getRateRequest(null, null, null, null, $customerDataSet->getId());
75 
76  $this->assertNotNull($rateRequest);
77  $this->assertEquals($address->getCountryId(), $rateRequest->getCountryId());
78  $this->assertEquals($address->getRegion()->getRegionId(), $rateRequest->getRegionId());
79  $this->assertEquals($address->getPostcode(), $rateRequest->getPostcode());
80 
81  $customerTaxClassId = $this->groupRepository->getById($customerDataSet->getGroupId())->getTaxClassId();
82  $this->assertEquals($customerTaxClassId, $rateRequest->getCustomerClassId());
83  }
$address
Definition: customer.php:38

Field Documentation

◆ $_model

$_model
protected

Definition at line 47 of file CalculationTest.php.

◆ $_objectManager

$_objectManager
protected

Definition at line 23 of file CalculationTest.php.

◆ $addressRepository

$addressRepository
protected

Definition at line 33 of file CalculationTest.php.

◆ $customerRepository

$customerRepository
protected

Definition at line 28 of file CalculationTest.php.

◆ $groupRepository

$groupRepository
protected

Definition at line 38 of file CalculationTest.php.

◆ FIXTURE_ADDRESS_ID

const FIXTURE_ADDRESS_ID = 1

Definition at line 42 of file CalculationTest.php.

◆ FIXTURE_CUSTOMER_ID

const FIXTURE_CUSTOMER_ID = 1

Definition at line 40 of file CalculationTest.php.


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