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

namespace GuzzleTestsBatch;

use 
GuzzleBatchNotifyingBatch;
use 
GuzzleBatchBatch;

/**
 * @covers GuzzleBatchNotifyingBatch
 */
class NotifyingBatchTest extends GuzzleTestsGuzzleTestCase
{
    public function 
testNotifiesAfterFlush()
    {
        
$batch $this->getMock('GuzzleBatchBatch', array('flush'), array(
            
$this->getMock('GuzzleBatchBatchTransferInterface'),
            
$this->getMock('GuzzleBatchBatchDivisorInterface')
        ));

        
$batch->expects($this->once())
            ->
method('flush')
            ->
will($this->returnValue(array('foo''baz')));

        
$data = array();
        
$decorator = new NotifyingBatch($batch, function ($batch) use (&$data) {
            
$data[] = $batch;
        });

        
$decorator->add('foo')->add('baz');
        
$decorator->flush();
        
$this->assertEquals(array(array('foo''baz')), $data);
    }

    
/**
     * @expectedException GuzzleCommonExceptionInvalidArgumentException
     */
    
public function testEnsuresCallableIsValid()
    {
        
$batch = new Batch(
            
$this->getMock('GuzzleBatchBatchTransferInterface'),
            
$this->getMock('GuzzleBatchBatchDivisorInterface')
        );
        
$decorator = new NotifyingBatch($batch'foo');
    }
}
Онлайн: 1
Реклама