16 $t = $this->getMockBuilder(
'Guzzle\Batch\BatchTransferInterface')
17 ->setMethods(array(
'transfer'))
21 $batch =
new Batch($t, $d);
24 $t->expects($this->exactly(3))
26 ->will($this->returnCallback(
function ($batch) use (&$called) {
27 if (++$called === 2) {
28 throw new \Exception(
'Foo');
33 $decorator->add(
'foo')->add(
'baz')->add(
'bar');
34 $result = $decorator->flush();
36 $e = $decorator->getExceptions();
37 $this->assertEquals(1, count($e));
38 $this->assertEquals(array(
'baz'), $e[0]->getBatch());
40 $decorator->clearExceptions();
41 $this->assertEquals(0, count($decorator->getExceptions()));
43 $this->assertEquals(array(
'foo',
'bar'), $result);