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,47 @@
<?php
namespace Guzzle\Tests\Http;
use Guzzle\Http\EntityBody;
use Guzzle\Http\IoEmittingEntityBody;
/**
* @covers Guzzle\Http\IoEmittingEntityBody
*/
class IoEmittingEntityBodyTest extends \Guzzle\Tests\GuzzleTestCase
{
protected $body;
protected $decorated;
public function setUp()
{
$this->decorated = EntityBody::factory('hello');
$this->body = new IoEmittingEntityBody($this->decorated);
}
public function testEmitsReadEvents()
{
$e = null;
$this->body->getEventDispatcher()->addListener('body.read', function ($event) use (&$e) {
$e = $event;
});
$this->assertEquals('hel', $this->body->read(3));
$this->assertEquals('hel', $e['read']);
$this->assertEquals(3, $e['length']);
$this->assertSame($this->body, $e['body']);
}
public function testEmitsWriteEvents()
{
$e = null;
$this->body->getEventDispatcher()->addListener('body.write', function ($event) use (&$e) {
$e = $event;
});
$this->body->seek(0, SEEK_END);
$this->assertEquals(5, $this->body->write('there'));
$this->assertEquals('there', $e['write']);
$this->assertEquals(5, $e['result']);
$this->assertSame($this->body, $e['body']);
$this->assertEquals('hellothere', (string) $this->body);
}
}