Open Journal Systems  3.3.0
BatchClosureTransferTest.php
1 <?php
2 
3 namespace Guzzle\Tests\Batch;
4 
6 
11 {
13  protected $transferStrategy;
14 
16  protected $itemsTransferred;
17 
18  protected function setUp()
19  {
20  $this->itemsTransferred = null;
22 
23  $this->transferStrategy = new BatchClosureTransfer(function (array $batch) use (&$itemsTransferred) {
25  return;
26  });
27  }
28 
29  public function testTransfersBatch()
30  {
31  $batchedItems = array('foo', 'bar', 'baz');
32  $this->transferStrategy->transfer($batchedItems);
33 
34  $this->assertEquals($batchedItems, $this->itemsTransferred);
35  }
36 
37  public function testTransferBailsOnEmptyBatch()
38  {
39  $batchedItems = array();
40  $this->transferStrategy->transfer($batchedItems);
41 
42  $this->assertNull($this->itemsTransferred);
43  }
44 
48  public function testEnsuresCallableIsCallable()
49  {
50  $foo = new BatchClosureTransfer('uh oh!');
51  }
52 }
Guzzle\Tests\Batch\BatchClosureTransferTest\setUp
setUp()
Definition: BatchClosureTransferTest.php:24
Guzzle\Tests\Batch\BatchClosureTransferTest\testTransferBailsOnEmptyBatch
testTransferBailsOnEmptyBatch()
Definition: BatchClosureTransferTest.php:43
Guzzle\Tests\Batch\BatchClosureTransferTest\$transferStrategy
$transferStrategy
Definition: BatchClosureTransferTest.php:16
Guzzle\Tests\GuzzleTestCase
Definition: GuzzleTestCase.php:22
Guzzle\Batch\BatchClosureTransfer
Definition: BatchClosureTransfer.php:11
Guzzle\Tests\Batch\BatchClosureTransferTest
Definition: BatchClosureTransferTest.php:10
Guzzle\Tests\Batch\BatchClosureTransferTest\$itemsTransferred
$itemsTransferred
Definition: BatchClosureTransferTest.php:22
Guzzle\Tests\Batch
Definition: AbstractBatchDecoratorTest.php:3
Guzzle\Tests\Batch\BatchClosureTransferTest\testTransfersBatch
testTransfersBatch()
Definition: BatchClosureTransferTest.php:35
Guzzle\Tests\Batch\BatchClosureTransferTest\testEnsuresCallableIsCallable
testEnsuresCallableIsCallable()
Definition: BatchClosureTransferTest.php:54