/** * @expectedException Imbo\Exception\TransformationException * @expectedExceptionCode 400 * @expectedExceptionMessage Watermark image not found */ public function testThrowsExceptionIfSpecifiedImageIsNotFound() { $image = $this->getMock('Imbo\\Model\\Image'); $e = new StorageException('File not found', 404); $storage = $this->getMock('Imbo\\Storage\\StorageInterface'); $storage->expects($this->once())->method('getImage')->with('publickey', 'foobar')->will($this->throwException($e)); $request = $this->getMock('Imbo\\Http\\Request\\Request'); $request->expects($this->once())->method('getPublicKey')->will($this->returnValue('publickey')); $event = $this->getMock('Imbo\\EventManager\\Event'); $event->expects($this->at(0))->method('getArgument')->with('image')->will($this->returnValue($image)); $event->expects($this->at(1))->method('getArgument')->with('params')->will($this->returnValue(array('img' => 'foobar'))); $event->expects($this->at(2))->method('getStorage')->will($this->returnValue($storage)); $event->expects($this->at(3))->method('getRequest')->will($this->returnValue($request)); $this->transformation->transform($event); }