public function testGetChange() { $object = new \stdClass(); $changeGenerator = new ChangeFactory(); $change = $changeGenerator->getChange($object); $this->assertInstanceOf('ChangeSet\\Change', $change); $this->assertFalse($change->isDirty()); }
public function remove($object) { $hash = spl_object_hash($object); if (isset($this->removedInstances[$hash]) || !(isset($this->managedInstances[$hash]) || isset($this->newInstances[$hash]))) { return null; } $change = $this->changeGenerator->getChange($object)->takeSnapshot(); if (isset($this->newInstances[$hash])) { unset($this->newInstances[$hash]); return $change; } unset($this->newInstances[$hash], $this->managedInstances[$hash]); // @todo if a new instance is found, should we schedule this one for removal or just // remove it from newInstances? $this->removedInstances[$hash] = $change; return $change; }