Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AddressDataGeneratorTest.php
Go to the documentation of this file.
1 <?php
7 
8 class AddressDataGeneratorTest extends \PHPUnit\Framework\TestCase
9 {
13  private $addressStructure = [
14  'postcode',
15  ];
16 
20  private $addressGenerator;
21 
22  public function setUp()
23  {
24  $this->addressGenerator = new \Magento\Setup\Model\Address\AddressDataGenerator();
25  }
26 
27  public function testPostcode()
28  {
29  mt_srand(42);
30  $address1 = $this->addressGenerator->generateAddress();
31 
32  mt_srand(66);
33  $address2 = $this->addressGenerator->generateAddress();
34 
35  $this->assertNotEquals($address1['postcode'], $address2['postcode']);
36  }
37 
38  public function testAddressStructure()
39  {
40  $address = $this->addressGenerator->generateAddress();
41 
42  foreach ($this->addressStructure as $addressField) {
43  $this->assertTrue(array_key_exists($addressField, $address));
44  }
45  }
46 }
$address
Definition: customer.php:38