Skip to content

Commit

Permalink
Merge pull request #11271 from jdalsem/test-metadata-delete-all
Browse files Browse the repository at this point in the history
chore(tests): deleting metadata now deletes individual metadata rows
  • Loading branch information
jdalsem committed Oct 12, 2017
2 parents 16b9906 + c7495ce commit a372e25
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions engine/tests/classes/Elgg/Mocks/Database/MetadataTable.php
Expand Up @@ -107,17 +107,16 @@ public function getAll(array $options = array()) {
/**
* {@inheritdoc}
*/
public function deleteAll(array $options = array()) {
$guids = elgg_extract('guids', $options);
$deleted = false;
foreach ($this->rows as $id => $row) {
if (empty($guids) || in_array($row->entity_guid, $guids)) {
$this->clearQuerySpecs($this->rows[$id]);
$deleted = true;
unset($this->rows[$id]);
}
public function delete($id) {
if (!isset($this->rows[$id])) {
return false;
}
return $deleted;
$row = $this->rows[$id];
$this->clearQuerySpecs($row);

unset($this->rows[$id]);

return true;
}

/**
Expand Down

0 comments on commit a372e25

Please sign in to comment.