/** * @expectedException InvalidArgumentException */ public function testReplaceItemException() { $this->storage->expects($this->once())->method('getMimeType')->with('key')->will($this->returnValue('text/html')); $file = $this->getMockBuilder('Zend_Form_Element_File')->disableOriginalConstructor()->getMock(); $file->expects($this->once())->method('getMimeType')->will($this->returnValue('binary/jpeg')); $this->service->replaceItem('key', $file); }