/**
  * {@inheritdoc}
  */
 public function __construct($name = null, array $data = [], $dataName = '')
 {
     parent::__construct($name, $data, $dataName);
     $this->billingType = new AddressType(AddressType::TYPE_BILLING);
     $this->shippingType = new AddressType(AddressType::TYPE_SHIPPING);
     $this->addressRepository = $this->createRepositoryMock([$this->billingType, $this->shippingType]);
     $this->em = $this->createEntityManagerMock($this->addressRepository);
     $this->registry = $this->createManagerRegistryMock($this->em);
 }
 /**
  * {@inheritdoc}
  */
 public function __construct($name = null, array $data = array(), $dataName = '')
 {
     parent::__construct($name, $data, $dataName);
     $this->billingType = new AddressType(AddressType::TYPE_BILLING);
     $this->shippingType = new AddressType(AddressType::TYPE_SHIPPING);
     $this->em = $this->createEntityManagerMock();
     $this->addressRepository = $this->createRepositoryMock([$this->billingType, $this->shippingType]);
     $this->addressRepository->expects($this->any())->method('findBy')->will($this->returnCallback(function ($params) {
         $result = [];
         foreach ($params['name'] as $name) {
             switch ($name) {
                 case AddressType::TYPE_BILLING:
                     $result[] = $this->billingType;
                     break;
                 case AddressType::TYPE_SHIPPING:
                     $result[] = $this->shippingType;
                     break;
             }
         }
         return $result;
     }));
 }