/** * @inheritdoc */ public function rename($newKey) { if ($this->storage->renameKey($this->key, $newKey)) { $event = new StorageEvent($this); // Set `oldKey` property that will be available only on rename $event->oldKey = $this->key; $this->key = $newKey; $this->eventManager()->fire(StorageEvent::FILE_RENAMED, $event); return true; } return false; }
/** * @dataProvider driverSet */ public function testRename(Storage $storage) { $storage->renameKey($this->key, $this->newKey); $this->assertTrue($storage->keyExists($this->newKey)); }