/** * @test * @group pmc */ public function testTransferException() { $curl = $this->_mockCurl(); $curl->expects($this->once())->method('init')->with('http://google.com'); $curl->expects($this->exactly(2))->method('setopt')->withConsecutive(array($this->equalTo(CURLOPT_RETURNTRANSFER), $this->equalTo(true)), array($this->equalTo(CURLOPT_HEADER), $this->equalTo(true))); $curl->expects($this->once())->method('exec')->will($this->returnValue(null)); $curl->expects($this->once())->method('errno')->will($this->returnValue(404)); $curl->expects($this->once())->method('error')->will($this->returnValue('Not Found!')); $request = new Request('GET', 'http://google.com', new \Bronto\DataObject(), $curl); try { $response = $request->respond(); $this->fail('Should not have made it here.'); } catch (\Bronto\Transfer\Exception $e) { $this->assertEquals(404, $e->getCode()); $this->assertEquals('Not Found!', $e->getMessage()); $this->assertEquals($request, $e->getRequest()); } }