public function testRemoveTypes() { $types = new ArrayCollection([$this->billingType, $this->shippingType]); $this->address->setTypes($types); $this->assertInstanceOf('OroB2B\\Bundle\\CustomerBundle\\Entity\\CustomerAddress', $this->address->removeType($this->billingType)); /** @var Collection|CustomerAddressToAddressType[] $addressesToTypes */ $addressesToTypes = $this->address->getAddressesToTypes(); $this->assertCount(1, $addressesToTypes); $addressesToTypesArray = $addressesToTypes->toArray(); $firstAddressesToType = array_shift($addressesToTypesArray); $this->assertEquals($this->shippingType, $firstAddressesToType->getType()); $this->assertEquals($this->address, $firstAddressesToType->getAddress()); }