1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25:
<?php
namespace Guzzle\Tests\Batch;
use Guzzle\Batch\BatchSizeDivisor;
class BatchSizeDivisorTest extends \Guzzle\Tests\GuzzleTestCase
{
public function testDividesBatch()
{
$queue = new \SplQueue();
$queue[] = 'foo';
$queue[] = 'baz';
$queue[] = 'bar';
$d = new BatchSizeDivisor(3);
$this->assertEquals(3, $d->getSize());
$d->setSize(2);
$batches = $d->createBatches($queue);
$this->assertEquals(array(array('foo', 'baz'), array('bar')), $batches);
}
}