Вход Регистрация
Файл: vkolhoze.com/vendor/guzzle/guzzle/tests/Guzzle/Tests/Batch/BatchClosureDivisorTest.php
Строк: 22
<?php

namespace GuzzleTestsBatch;

use 
GuzzleBatchBatchClosureDivisor;

/**
 * @covers GuzzleBatchBatchClosureDivisor
 */
class BatchClosureDivisorTest extends GuzzleTestsGuzzleTestCase
{
    
/**
     * @expectedException GuzzleCommonExceptionInvalidArgumentException
     */
    
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);
    }
}
Онлайн: 1
Реклама