Exemplo n.º 1
0
 protected function setUp()
 {
     $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
     $this->scopeConfig = $this->getMock('Magento\\Framework\\App\\Config', [], [], '', false);
     $this->address = $objectManager->getObject('Magento\\Quote\\Model\\Quote\\Address', ['scopeConfig' => $this->scopeConfig]);
     $this->quote = $this->getMock('Magento\\Quote\\Model\\Quote', [], [], '', false);
     $this->address->setQuote($this->quote);
 }
Exemplo n.º 2
0
 public function testPopulateBeforeSaveData()
 {
     /** Preconditions */
     $customerId = 1;
     $customerAddressId = 1;
     $this->_address->setQuote($this->_quote);
     $this->assertNotEquals($customerId, $this->_address->getCustomerId(), "Precondition failed: Customer ID was not set.");
     $this->assertNotEquals(1, $this->_address->getQuoteId(), "Precondition failed: Quote ID was not set.");
     $this->assertNotEquals($customerAddressId, $this->_address->getCustomerAddressId(), "Precondition failed: Customer address ID was not set.");
     /** @var \Magento\Customer\Api\Data\AddressInterfaceFactory $addressFactory */
     $addressFactory = Bootstrap::getObjectManager()->create('Magento\\Customer\\Api\\Data\\AddressInterfaceFactory');
     $customerAddressData = $addressFactory->create()->setId($customerAddressId);
     $this->_address->setCustomerAddressData($customerAddressData);
     $this->_address->save();
     $this->assertEquals($customerId, $this->_address->getCustomerId());
     $this->assertEquals($this->_quote->getId(), $this->_address->getQuoteId());
     $this->assertEquals($customerAddressId, $this->_address->getCustomerAddressId());
 }