コード例 #1
0
ファイル: MessageTestTrait.php プロジェクト: wandu/framework
 public function testProtocolVersion()
 {
     $message = $this->message->withProtocolVersion('1.0');
     // The string MUST contain only the HTTP version number (e.g., "1.1", "1.0").
     static::assertEquals("1.0", $message->getProtocolVersion());
     // This method MUST be implemented in such a way as to retain the
     // immutability of the message, and MUST return an instance that has the
     // new protocol version.
     static::assertNotSame($message, $message->withProtocolVersion("1.0"));
     static::assertEquals("1.1", $message->withProtocolVersion("1.1")->getProtocolVersion());
 }
コード例 #2
0
 public function testProtocolMutatorReturnsCloneWithChanges()
 {
     $message = $this->message->withProtocolVersion('1.0');
     $this->assertNotSame($this->message, $message);
     $this->assertEquals('1.0', $message->getProtocolVersion());
 }
コード例 #3
0
ファイル: MessageDecorator.php プロジェクト: php-http/message
 /**
  * {@inheritdoc}
  */
 public function withProtocolVersion($version)
 {
     $new = clone $this;
     $new->message = $this->message->withProtocolVersion($version);
     return $new;
 }