diff options
Diffstat (limited to 'vendor/guzzle/guzzle/tests/Guzzle/Tests/Batch/BatchClosureDivisorTest.php')
-rw-r--r-- | vendor/guzzle/guzzle/tests/Guzzle/Tests/Batch/BatchClosureDivisorTest.php | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/vendor/guzzle/guzzle/tests/Guzzle/Tests/Batch/BatchClosureDivisorTest.php b/vendor/guzzle/guzzle/tests/Guzzle/Tests/Batch/BatchClosureDivisorTest.php new file mode 100644 index 0000000..753db7d --- /dev/null +++ b/vendor/guzzle/guzzle/tests/Guzzle/Tests/Batch/BatchClosureDivisorTest.php @@ -0,0 +1,36 @@ +<?php + +namespace Guzzle\Tests\Batch; + +use Guzzle\Batch\BatchClosureDivisor; + +/** + * @covers Guzzle\Batch\BatchClosureDivisor + */ +class BatchClosureDivisorTest extends \Guzzle\Tests\GuzzleTestCase +{ + /** + * @expectedException Guzzle\Common\Exception\InvalidArgumentException + */ + public function testEnsuresCallableIsCallable() + { + $d = new BatchClosureDivisor(new \stdClass()); + } + + public function testDividesBatch() + { + $queue = new \SplQueue(); + $queue[] = 'foo'; + $queue[] = 'baz'; + + $d = new BatchClosureDivisor(function (\SplQueue $queue, $context) { + return array( + array('foo'), + array('baz') + ); + }, 'Bar!'); + + $batches = $d->createBatches($queue); + $this->assertEquals(array(array('foo'), array('baz')), $batches); + } +} |