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

Public Member Functions

 testRetrieve ()
 
 testRetrieveCached ()
 
 testRetrieveException ()
 
 testRemove ()
 

Protected Member Functions

 setUp ()
 

Protected Attributes

 $_model
 

Detailed Description

Definition at line 11 of file AddressRegistryTest.php.

Member Function Documentation

◆ setUp()

setUp ( )
protected

Definition at line 18 of file AddressRegistryTest.php.

19  {
21  ->create(\Magento\Customer\Model\AddressRegistry::class);
22  }

◆ testRemove()

testRemove ( )

@magentoDataFixture Magento/Customer/_files/customer.php @magentoDataFixture Magento/Customer/_files/customer_address.php @expectedException \Magento\Framework\Exception\NoSuchEntityException

Definition at line 68 of file AddressRegistryTest.php.

69  {
70  $addressId = 1;
71  $address = $this->_model->retrieve($addressId);
72  $this->assertInstanceOf(\Magento\Customer\Model\Address::class, $address);
73  $address->delete();
74  $this->_model->remove($addressId);
75  $this->_model->retrieve($addressId);
76  }
$address
Definition: customer.php:38

◆ testRetrieve()

testRetrieve ( )

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

Definition at line 28 of file AddressRegistryTest.php.

29  {
30  $addressId = 1;
31  $address = $this->_model->retrieve($addressId);
32  $this->assertInstanceOf(\Magento\Customer\Model\Address::class, $address);
33  $this->assertEquals($addressId, $address->getId());
34  }
$address
Definition: customer.php:38

◆ testRetrieveCached()

testRetrieveCached ( )

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

Definition at line 40 of file AddressRegistryTest.php.

41  {
42  $addressId = 1;
43  $addressBeforeDeletion = $this->_model->retrieve($addressId);
45  ->create(\Magento\Customer\Model\Address::class);
46  $address2->load($addressId)
47  ->delete();
48  $addressAfterDeletion = $this->_model->retrieve($addressId);
49  $this->assertEquals($addressBeforeDeletion, $addressAfterDeletion);
50  $this->assertInstanceOf(\Magento\Customer\Model\Address::class, $addressAfterDeletion);
51  $this->assertEquals($addressId, $addressAfterDeletion->getId());
52  }

◆ testRetrieveException()

testRetrieveException ( )

@expectedException \Magento\Framework\Exception\NoSuchEntityException

Definition at line 57 of file AddressRegistryTest.php.

58  {
59  $addressId = 1;
60  $this->_model->retrieve($addressId);
61  }

Field Documentation

◆ $_model

$_model
protected

Definition at line 16 of file AddressRegistryTest.php.


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