/** * Removes duplicate values from a LDAP attribute * * @param string $attribName * @return void */ public function removeDuplicatesFromAttribute($attribName) { Attribute::removeDuplicatesFromAttribute($this->currentData, $attribName); }
public function testRemoveDuplicates() { $data = array('strings1' => array('value1', 'value2', 'value2', 'value3'), 'strings2' => array('value1', 'value2', 'value3', 'value4'), 'boolean1' => array('TRUE', 'TRUE', 'TRUE', 'TRUE'), 'boolean2' => array('TRUE', 'FALSE', 'TRUE', 'FALSE')); $expected = array('strings1' => array('value1', 'value2', 'value3'), 'strings2' => array('value1', 'value2', 'value3', 'value4'), 'boolean1' => array('TRUE'), 'boolean2' => array('TRUE', 'FALSE')); Attribute::removeDuplicatesFromAttribute($data, 'strings1'); Attribute::removeDuplicatesFromAttribute($data, 'strings2'); Attribute::removeDuplicatesFromAttribute($data, 'boolean1'); Attribute::removeDuplicatesFromAttribute($data, 'boolean2'); $this->assertEquals($expected, $data); }