20 $e->addSuccessfulCommand($c1)->addFailedCommand($c2);
21 $this->assertSame(array($c1), $e->getSuccessfulCommands());
22 $this->assertSame(array($c2), $e->getFailedCommands());
23 $this->assertSame(array($c1, $c2), $e->getAllCommands());
28 $r1 =
new Request(
'GET',
'http://foo.com');
29 $r2 =
new Request(
'GET',
'http://foobaz.com');
31 $e->addSuccessfulRequest($r1)->addFailedRequest($r2);
34 $this->assertInstanceOf(
'Guzzle\Service\Exception\CommandTransferException', $ce);
35 $this->assertEquals(
'Test', $ce->getMessage());
36 $this->assertEquals(123, $ce->getCode());
37 $this->assertSame(array($r1), $ce->getSuccessfulRequests());
38 $this->assertSame(array($r2), $ce->getFailedRequests());
43 $r1 =
new Request(
'GET',
'http://foo.com');
44 $e1 = new \Exception(
'foo');
45 $c1 = $this->getMockBuilder(
'Guzzle\Tests\Service\Mock\Command\MockCommand')
46 ->setMethods(array(
'getRequest'))
48 $c1->expects($this->once())->method(
'getRequest')->will($this->returnValue($r1));
51 $e->addFailedRequestWithException($r1, $e1);
53 $ce->addFailedCommand($c1);
55 $this->assertSame($e1, $ce->getExceptionForFailedCommand($c1));
61 $e->add(
new \Exception(
'bar'));
62 $e->addFailedRequestWithException(
new Request(
'GET',
'http://www.foo.com'),
new \Exception(
'foo'));
64 $this->assertEquals(2, count($ce));