/** * @test */ public function onDeleteResourceShouldDelegateToStorage() { $this->plugin->attachTo($this->filelib); $this->plugin->expects($this->atLeastOnce())->method('getProvidedVersions')->will($this->returnValue(array('xooxer', 'lusser'))); $this->storage->expects($this->exactly(2))->method('versionExists')->with($this->isInstanceOf('Xi\\Filelib\\Resource\\Resource'), $this->isInstanceOf('Xi\\Filelib\\Version'))->will($this->onConsecutiveCalls(true, false)); $this->storage->expects($this->once())->method('deleteVersion')->with($this->isInstanceOf('Xi\\Filelib\\Resource\\Resource'), $this->isInstanceOf('Xi\\Filelib\\Version')); $resource = Resource::create(array('mimetype' => 'image/png')); $event = new ResourceEvent($resource); $this->plugin->onResourceDelete($event); }