init: import production code mss.nahaichuan.com (exclude Runtime/Uploads/backups/logs)

这个提交包含在:
Developer
2026-10-30 10:18:50 +08:00
当前提交 1f3e0ce2f6
共有 9291 个文件被更改,包括 1776674 次插入 和 0 次删除

查看文件

@@ -0,0 +1,86 @@
<?php
namespace Guzzle\Tests\Batch;
use Guzzle\Batch\BatchBuilder;
/**
* @covers Guzzle\Batch\BatchBuilder
*/
class BatchBuilderTest extends \Guzzle\Tests\GuzzleTestCase
{
private function getMockTransfer()
{
return $this->getMock('Guzzle\Batch\BatchTransferInterface');
}
private function getMockDivisor()
{
return $this->getMock('Guzzle\Batch\BatchDivisorInterface');
}
private function getMockBatchBuilder()
{
return BatchBuilder::factory()
->transferWith($this->getMockTransfer())
->createBatchesWith($this->getMockDivisor());
}
public function testFactoryCreatesInstance()
{
$builder = BatchBuilder::factory();
$this->assertInstanceOf('Guzzle\Batch\BatchBuilder', $builder);
}
public function testAddsAutoFlush()
{
$batch = $this->getMockBatchBuilder()->autoFlushAt(10)->build();
$this->assertInstanceOf('Guzzle\Batch\FlushingBatch', $batch);
}
public function testAddsExceptionBuffering()
{
$batch = $this->getMockBatchBuilder()->bufferExceptions()->build();
$this->assertInstanceOf('Guzzle\Batch\ExceptionBufferingBatch', $batch);
}
public function testAddHistory()
{
$batch = $this->getMockBatchBuilder()->keepHistory()->build();
$this->assertInstanceOf('Guzzle\Batch\HistoryBatch', $batch);
}
public function testAddsNotify()
{
$batch = $this->getMockBatchBuilder()->notify(function() {})->build();
$this->assertInstanceOf('Guzzle\Batch\NotifyingBatch', $batch);
}
/**
* @expectedException Guzzle\Common\Exception\RuntimeException
*/
public function testTransferStrategyMustBeSet()
{
$batch = BatchBuilder::factory()->createBatchesWith($this->getMockDivisor())->build();
}
/**
* @expectedException Guzzle\Common\Exception\RuntimeException
*/
public function testDivisorStrategyMustBeSet()
{
$batch = BatchBuilder::factory()->transferWith($this->getMockTransfer())->build();
}
public function testTransfersRequests()
{
$batch = BatchBuilder::factory()->transferRequests(10)->build();
$this->assertInstanceOf('Guzzle\Batch\BatchRequestTransfer', $this->readAttribute($batch, 'transferStrategy'));
}
public function testTransfersCommands()
{
$batch = BatchBuilder::factory()->transferCommands(10)->build();
$this->assertInstanceOf('Guzzle\Batch\BatchCommandTransfer', $this->readAttribute($batch, 'transferStrategy'));
}
}