Open Journal Systems  3.3.0
NotifyingBatchTest.php
1 <?php
2 
3 namespace Guzzle\Tests\Batch;
4 
7 
12 {
13  public function testNotifiesAfterFlush()
14  {
15  $batch = $this->getMock('Guzzle\Batch\Batch', array('flush'), array(
16  $this->getMock('Guzzle\Batch\BatchTransferInterface'),
17  $this->getMock('Guzzle\Batch\BatchDivisorInterface')
18  ));
19 
20  $batch->expects($this->once())
21  ->method('flush')
22  ->will($this->returnValue(array('foo', 'baz')));
23 
24  $data = array();
25  $decorator = new NotifyingBatch($batch, function ($batch) use (&$data) {
26  $data[] = $batch;
27  });
28 
29  $decorator->add('foo')->add('baz');
30  $decorator->flush();
31  $this->assertEquals(array(array('foo', 'baz')), $data);
32  }
33 
37  public function testEnsuresCallableIsValid()
38  {
39  $batch = new Batch(
40  $this->getMock('Guzzle\Batch\BatchTransferInterface'),
41  $this->getMock('Guzzle\Batch\BatchDivisorInterface')
42  );
43  $decorator = new NotifyingBatch($batch, 'foo');
44  }
45 }
Guzzle\Tests\GuzzleTestCase
Definition: GuzzleTestCase.php:22
Guzzle\Tests\Batch\NotifyingBatchTest\testEnsuresCallableIsValid
testEnsuresCallableIsValid()
Definition: NotifyingBatchTest.php:37
Guzzle\Batch\AbstractBatchDecorator\add
add($item)
Definition: AbstractBatchDecorator.php:38
Guzzle\Tests\Batch\NotifyingBatchTest
Definition: NotifyingBatchTest.php:11
Guzzle\Tests\Batch
Definition: AbstractBatchDecoratorTest.php:3
Guzzle\Batch\Batch
Definition: Batch.php:15
Guzzle\Batch\NotifyingBatch
Definition: NotifyingBatch.php:10
Guzzle\Tests\Batch\NotifyingBatchTest\testNotifiesAfterFlush
testNotifiesAfterFlush()
Definition: NotifyingBatchTest.php:13