// Good, modern name.
return $prop;
}
+ // Handling for legacy addition of billing details.
+ if ($newName === NULL && substr($prop, -2) === '-' . \CRM_Core_BAO_LocationType::getBilling()
+ && isset(static::$propMap[substr($prop, 0, -2)])
+ ) {
+ $newName = substr($prop, 0, -2);
+ }
+
if ($newName === NULL) {
if ($silent) {
// Only for use by offsetExists
$this->assertEquals(123, $propertyBag['contact_id']);
}
+ /**
+ * Test that emails set by the legacy method of 'email-5' can be retrieved with getEmail.
+ */
+ public function testSetBillingEmailLegacy() {
+ $localPropertyBag = new PropertyBag();
+ $localPropertyBag->mergeLegacyInputParams(['email-' . \CRM_Core_BAO_LocationType::getBilling() => 'a@b.com']);
+ $this->assertEquals('a@b.com', $localPropertyBag->getEmail());
+ }
+
/**
*/
public function testMergeInputs() {
'contactID' => 123,
'contributionRecurID' => 456,
]);
- $this->assertEquals("We have merged input params into the property bag for now but please rewrite code to not use this.", $propertyBag->lastWarning);
+ $this->assertEquals('We have merged input params into the property bag for now but please rewrite code to not use this.', $propertyBag->lastWarning);
$this->assertEquals(123, $propertyBag->getContactID());
$this->assertEquals(456, $propertyBag->getContributionRecurID());
}