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()); }
public function testProtocolMutatorReturnsCloneWithChanges() { $message = $this->message->withProtocolVersion('1.0'); $this->assertNotSame($this->message, $message); $this->assertEquals('1.0', $message->getProtocolVersion()); }
/** * {@inheritdoc} */ public function withProtocolVersion($version) { $new = clone $this; $new->message = $this->message->withProtocolVersion($version); return $new; }