예제 #1
0
     it("gets the body stream", function () {
         $message = new Message(['body' => 'Hello World!']);
         $stream = $message->stream();
         expect((string) $stream)->toBe('Hello World!');
     });
     it("sets the body using a stream", function () {
         $message = new Message();
         $message->stream('Hello World!');
         $stream = $message->stream();
         expect((string) $stream)->toBe('Hello World!');
     });
 });
 describe("->chunkSize()", function () {
     it("gets/sets the chunk size", function () {
         $message = new Message();
         expect($message->chunkSize())->toBe(256);
         expect($message->chunkSize(512))->toBe($message);
         expect($message->chunkSize())->toBe(512);
     });
 });
 describe("->export()", function () {
     it("returns the query", function () {
         $message = new Message(['scheme' => 'http', 'host' => 'www.domain.com', 'port' => 80, 'username' => 'username', 'password' => 'password', 'path' => 'index.php']);
         expect($message->export())->toEqual(['body' => $message->stream()]);
     });
 });
 describe("->__toString", function () {
     it("casts to a string", function () {
         $message = new Message(['body' => 'Body Message']);
         expect((string) $message)->toBe('Body Message');
     });