public function testSetDefaults()
 {
     $types = new ArrayCollection([$this->billingType, $this->shippingType]);
     $this->assertCount(0, $this->address->getDefaults());
     $this->address->setTypes($types);
     $this->assertCount(0, $this->address->getDefaults());
     $this->assertInstanceOf('OroB2B\\Bundle\\CustomerBundle\\Entity\\CustomerAddress', $this->address->setDefaults([$this->billingType]));
     $this->assertCount(1, $this->address->getDefaults());
     $this->address->setDefaults([$this->billingType, $this->shippingType]);
     $this->assertCount(2, $this->address->getDefaults());
     $this->address->setTypes(new ArrayCollection([$this->billingType]));
     $this->assertCount(0, $this->address->getDefaults());
     $this->address->setDefaults([$this->shippingType]);
     $this->assertCount(0, $this->address->getDefaults());
 }
 /**
  * @return array
  */
 public function submitWithFormSubscribersProvider()
 {
     $customerAddress1 = new CustomerAddress();
     $customerAddress1->setTypes(new ArrayCollection([$this->billingType, $this->shippingType]));
     $customerAddress2 = new CustomerAddress();
     $customerAddress2->setTypes(new ArrayCollection([$this->billingType, $this->shippingType]))->setDefaults(new ArrayCollection([$this->billingType, $this->shippingType]));
     $customerAddressExpected = new CustomerAddress();
     $customerAddressExpected->setPrimary(true)->addType($this->billingType)->addType($this->shippingType)->removeType($this->billingType)->removeType($this->shippingType)->addType($this->billingType)->addType($this->shippingType)->setDefaults(new ArrayCollection([$this->billingType, $this->shippingType]));
     $customer = new Customer();
     $customer->addAddress($customerAddress1);
     $customer->addAddress($customerAddress2);
     return ['FixCustomerAddressesDefaultSubscriber check' => ['options' => [], 'defaultData' => $customerAddress1, 'viewData' => $customerAddress1, 'submittedData' => ['types' => [AddressType::TYPE_BILLING, AddressType::TYPE_SHIPPING], 'defaults' => ['default' => [AddressType::TYPE_BILLING, AddressType::TYPE_SHIPPING]], 'primary' => true], 'expectedData' => $customerAddressExpected, 'otherAddresses' => [$customerAddress2], 'updateOwner' => $customer]];
 }