public function testGetTypeLabels() { $this->assertEquals(array(), $this->address->getTypeLabels()); $billing = new AddressType('billing'); $billing->setLabel('Billing'); $this->address->addType($billing); $shipping = new AddressType('shipping'); $shipping->setLabel('Shipping'); $this->address->addType($shipping); $this->assertEquals(array('Billing', 'Shipping'), $this->address->getTypeLabels()); }
/** * Get address mock. * * @param array $addressTypes * @param bool $isEmpty * @return \PHPUnit_Framework_MockObject_MockObject */ protected function getTypedAddressMock(array $addressTypes, $isEmpty = false) { $address = $this->getMockBuilder('Oro\\Bundle\\AddressBundle\\Entity\\AbstractTypedAddress')->disableOriginalConstructor()->setMethods(array('getTypes', 'isEmpty'))->getMockForAbstractClass(); $addressTypeEntities = array(); foreach ($addressTypes as $name => $label) { $addressType = new AddressType($name); $addressType->setLabel($label); $addressTypeEntities[] = $addressType; } $address->expects($this->any())->method('getTypes')->will($this->returnValue($addressTypeEntities)); $address->expects($this->once())->method('isEmpty')->will($this->returnValue($isEmpty)); return $address; }
public function testToString() { $this->assertEquals('', $this->type); $this->type->setLabel('Shipping'); $this->assertEquals('Shipping', (string) $this->type); }
/** * @param string $key * @param AddressType $entity */ public function fillEntityData($key, $entity) { $label = ucfirst($entity->getName()) . ' Type'; $entity->setLabel($label); }