/** * Delete all matching values from old and new arrays and return the * remaining new values as insert values and the remaining old values as * delete values. * * @param array $oldValues * @param array $newValues * @param PropertyTableDefinition $propertyTable * * @return array */ private function arrayDeleteMatchingValues($oldValues, $newValues, $propertyTable) { $isString = $propertyTable->getDIType() === DataItem::TYPE_BLOB; // Cycle through old values foreach ($oldValues as $oldKey => $oldValue) { // Cycle through new values foreach ($newValues as $newKey => $newValue) { // #2061 // Loose comparison on a string will fail for cases like 011 == 0011 // therefore use the strict comparison and have the values // remain if they don't match if ($isString && $newValue !== $oldValue) { continue; } // Delete matching values // use of == is intentional to account for oldValues only // containing strings while new values might also contain other // types if ($newValue == $oldValue) { unset($newValues[$newKey]); unset($oldValues[$oldKey]); } } } // Arrays have to be renumbered because database functions expect an // element with index 0 to be present in the array return array(array_values($newValues), array_values($oldValues)); }
public function testGetFixedProperty() { $instance = new PropertyTableDefinition('foo', 'bar'); $this->setExpectedException('OutOfBoundsException'); $instance->getFixedProperty(); }